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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    ll A, B, C; cin >> A >> B >> C;
    ll K; cin >> K;
    ll m = max(A, max(B, C));
    cout << A+B+C-m + (m << K) << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

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

using namespace std;

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

  vector<double> x(N);
  vector<string> u(N);

  double sum = 0;
  int i;
  for(i=0; i<N; i++){
    cin >> x[i]; cin >> u[i];
  }

  for(i=0; i<N; i++)
    if(u[i] == "JPY")
      sum += x[i];
    else
      sum += 380000*x[i];

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr, reverse=True)
if n == 1:
    print(0)
else:
    total = arr[0]
    for i in range(1, n//2):
        total += 2*arr[i]
    if n % 2 == 1:
        total += arr[n//2]
    print(total)


Measured memory_bytes: 31476
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P3;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e4 + 5);
const double EPS = 1e-11;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n;
    double k, t, u, v, l, d[205], r=0.0, ans=0.0;
    cin >> n >> k >> t >> u >> v >> l;
    REP(i,n) cin >> d[i+1];
    d[0] = 0;
    d[n+1] = l;
    REP(i,n+1){
        double di = d[i+1]-d[i];
        ans += min(r,di/v) + max(0.0,di-r*v)/u;
        r -= min(r,di/v);
        r = min((k+1.0)*t, r+t);
    }
    printf("%.8lf\n",ans);
    return 0;
}



Measured memory_bytes: 3292
n=input()
s=input()
n=int(n)

r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b

for i in range(1,n-1):
  m=min(i,n-1-i)
  for j in range(1,m+1):
    if s[i-j]!=s[i]:
      if s[i]!=s[i+j]:
        if s[i+j]!=s[i-j]:
          ans=ans-1
print(ans)

Measured memory_bytes: 9208
# coding: utf-8
def main():
    n, m, l = map(int, raw_input().split())
    mat_A = [] # (n, m)
    mat_B = [] # (m, l)
    for i in range(n):
        mat_A.append(map(int, raw_input().split()))

    for j in range(m):
        mat_B.append(map(int, raw_input().split()))

    for i in range(n):
        c = [0 for g in range(l)]
        for j in range(l):
            for k in range(m):
              #  print "n:{}, m:{}, l:{}".format(i,k,j)
                try:
                    c[j] += mat_A[i][k] * mat_B[k][j]
                except:
                    print "n: {}, m: {}, l: {}".format(i,k,j)
        print " ".join(map(str, c))
if __name__ == "__main__":
    main()

Measured memory_bytes: 7032
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;
int mon[3]={500,100,50},num;
int have[3];

int main(){
    int a,b,c,d;
    while(scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF){
        have[0]=a;
        have[1]=b;
        have[2]=c;
        num=0;
        for(int i=0;i<=a;i++){
            for(int j=0;j<=b;j++){
                for(int k=0;k<=c;k++){
                    if(i*500+j*100+k*50==d) num++;
                }
            }
        }
        printf("%d\n",num);
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int sum=0,a;
  for(int i=0;i<5;i++){
    cin >> a;
    if(a<40){
      a=40;
    }
    sum+=a;
  }
  cout << sum/5 << endl;
  return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int n;
  ll ret = 1;
  scanf("%d", &n);
  for(int i = 2; i <= n; i++) {
    ret *= i;
    ret %= 1000000007;
  }
  printf("%lld\n", ret);
}


Measured memory_bytes: 256
d, g = map(int, input().split())
problem = []
for i in range(d):
    problem.append(list(map(int, input().split())))

num_min = 1000
for bit in range(1 << d):
    sum = 0
    num = 0
    for i in range(d):
        if bit & (1 << i):
            sum += 100 * (i + 1) * problem[i][0] + problem[i][1]
            num += problem[i][0]
    if sum >= g:
        num_min = min(num_min, num)
    else:
        for j in range(d - 1, -1, -1):
            if bit & (1 << j):
                continue
            for k in range(problem[j][0]):
                if sum >= g:
                    break
                sum += 100 * (j + 1)
                num += 1
        if sum >= g:
            num_min = min(num_min, num)

print(num_min)

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

int M,W;
vector<int>bm,bw;
int memo[12][1<<12];

int val(int i,int j){
    int ab=abs(bm[i]-bw[j]);
    return ab*(ab-30)*(ab-30);
}

int calc(int n,int b){
    if(n==M)return 0;
    if(~memo[n][b])return memo[n][b];
    int ret=calc(n+1,b);
    for(int i=0;i<W;i++){
        if(b>>i&1)continue;
        ret=max(ret,calc(n+1,b|(1<<i))+val(n,i));
    }
    return memo[n][b]=ret;
}

int main(){
    while(cin>>M>>W,M||W){
        bm.resize(M);
        bw.resize(W);
        for(int i=0;i<M;i++)cin>>bm[i];
        for(int i=0;i<W;i++)cin>>bw[i];

        memset(memo,-1,sizeof(memo));
        cout<<calc(0,0)<<endl;
    }
    return 0;
}

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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;


const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
int cnt[N];
int n, k, ans;

int add(int x, int y) {
    int ret = x + y;
    if (ret >= MOD)ret -= MOD;
    return ret;
}

int mul(int x, int y) {
    return 1LL * x * y % MOD;
}

int sub(int x, int y) {
    int ret = x - y;
    if (ret < 0)ret += MOD;
    return ret;
}

int power(int b, int p) {
    if (p == 1)return b;
    if (p & 1)return mul(b, power(b, p - 1));
    int res = power(b, p / 2);
    return mul(res, res);
}

void solve() {
    for (int i = k; i >= 1; i--) {
        int c = k / i;
        cnt[i] = power(c, n);
        for (int j = i + i; j <= k; j += i) {
            cnt[i] = sub(cnt[i], cnt[j]);
        }
        ans = add(ans, mul(i, cnt[i]));
    }

}

int main() {

#ifndef ONLINE_JUDGE
//    freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n >> k;
    solve();
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4036
#
# abc081 c
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5 2
1 1 2 2 5"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4 4
1 1 2 2"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """10 3
5 1 3 2 4 1 1 2 3 4"""
        output = """3"""
        self.assertIO(input, output)


def resolve():
    N, K = map(int, input().split())
    a = list(map(int, input().split()))
    an = [0] * N
    for i in a:
        an[i-1] += 1
    an.sort(reverse=True)
    ans = 0
    for i in an:
        if K == 0:
            ans += i
        else:
            K -= 1
    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 40040
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  ll w, h, x, y;
  cin >> w >> h >> x >>  y;

  int flg = 0;

  if(x * 2 == w && y * 2 == h){
    flg = 1;
  }

  double ans = (double)h * w/2;


  cout << fixed << setprecision(10) <<  ans << " " << flg << endl;
  return 0;
}


Measured memory_bytes: 3756
#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;
}
using ll = long long;

#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);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k, x;
    cin >> k >> x;
    cout << (500 * k >= x ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll A,B,K;
    cin >>A>>B>>K;
    ll now=K;
    ll mx=0;
    rep(i,min(B-A,K)){
        cout<<A+i<<endl;
        now--;
        mx=A+i;
    }

    rep(i,min(B-mx,K)){
        if(B-mx>=K){
            cout<<B-K+i+1<<endl;
        }else{
            cout<<mx+i+1<<endl;
        }
    }




    return 0;
    

}

Measured memory_bytes: 3632
import java.util.*;

public class Main {

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

    int shou = wallet/100;
    int shou2 = wallet%100;
    if(shou2%10>=5)
      shou2 -= 5;
    else
      shou++;
    if(shou >= (shou2/5+2))
      System.out.println(1);
    else if(wallet%105 == 0)
      System.out.println(1);
    else
      System.out.println(0);
  }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll A, B, C;
ll t;
ll ret = 0;

void input() {
  IN(A);
  IN(B);
}

void solve() {
  ret = (A - 2*B);
  if (ret < 0) ret = 0;
  PRINT(ret);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
def main():
    from collections import defaultdict
    from collections import Counter
    import sys

    n = int(input())
    a = list(map(int, sys.stdin.readline().split()))

    d = Counter(a)
    e = defaultdict(int)

    base = sum(v*(v-1)//2 for v in d.values())

    for k, v in d.items():
        if v <= 1:
            e[k] = base - 0
        else:
            e[k] = base - (v - 1)

    p = [str(e[i])+'\n' for i in a]
    q = ''.join(p)
    print(q)


if __name__ == '__main__':
    main()


Measured memory_bytes: 44272
#include <stdio.h>
#define max(X, Y) ((X) > (Y) ? (X) : (Y))
#define min(X, Y) ((X) < (Y) ? (X) : (Y))

int m, minv, maxv;
int p[205];

int main()
{
    scanf("%d %d %d", &m, &minv, &maxv);

    while (m) {
        int ans = -1;
        int max_gap = -1;
        
        for (int i = 0; i < m; i++) {
            scanf("%d", &p[i]);
        }

        for (int i = maxv; i >= minv; i--) {

            int gap = p[i - 1] - p[i];

            if (gap > max_gap) {
                max_gap = gap;
                ans = i;
            }
        }

        printf("%d\n", ans);
        
        scanf("%d %d %d", &m, &minv, &maxv);
    }
    

    return 0;
}



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

int main(){
    int N;
    cin >> N;
    int count = 0;
    vector<int> arr(N);
    for(int i=0; i<N; i++){
        cin >> arr[i];
        if(arr[i]!=i+1){
            count++;
        }
    }
    if(count > 2) cout << "NO" << endl;
    else cout << "YES" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/

ll calc(ll x,ll y){
  if(x<y)return 0;
  if(y == 0)return 1;
  if(y == 1)return x;
  if(y == 2)return x*(x-1)/2;
  return x*(x-1)*(x-2)/6;
}

string N;
ll k;
ll ans;
int main(){FAST;
cin>>N>>k;
ll n = N.length();

for(ll i=1;i<=n-1;++i){
  if(i<k)continue;
  ans+=9*calc(i-1,k-1)*pow(9,k-1);
}
// cout<<ans<<'\n';
for(ll i=0;i<n;++i){
  if(i == 0){
    ll foo = N[i]-'1';
    ans+=foo*calc(n-i-1,k-1)*pow(9,k-1);
    k--;
  }
  else if(N[i]>'0'){
    ll foo = N[i]-'1';
    ans+=foo*calc(n-i-1,k-1)*pow(9,k-1);
    ans+=calc(n-i-1,k)*pow(9,k);
    k--;
  }
  if(k == 0){
    ans++;
    break;
  }
}
cout<<ans;
return 0;
}

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

#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll MOD = 1000000007;
const long long INF = 1LL << 60;
//cout<<fixed<<setprecision(10);

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

signed main()
{   
    gearup;
    int n; cin >> n;
    vector<int> d(n);
    rep(i,n) cin >> d[i];
    
    //累積和
    vector<ll> s(n+1,0);
    rep(i,n)s[i+1] = s[i] + d[i];
    ll res = 0;
    rep(i,n-1){
        res += d[i]*(s[n]-s[i+1]);
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)
 
using namespace std;
 
typedef long long ll;
// combination
// O(n)
 
template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

template <class T, class U> constexpr T power(T x, U exp) {
  T ret = static_cast<T>(1);
  while (exp) {
    if (exp % static_cast<U>(2) == static_cast<U>(1))
      ret *= x;
    exp /= static_cast<U>(2);
    x *= x;
  }
  return ::std::move(ret);
} 

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	using mint = modint<1000000007>;

	ll n, a, b;
	cin >> n >> a >> b;
 
	mint ans = power<mint, ll>(mint(2), n);
	ans -= mint(1);
	
	mint t1 = mint(1);
	rep(i, a){
		t1 *= mint(n-i);
		t1 /= mint(i+1);
	}
	ans -= t1;

	mint t2 = mint(1);
	rep(i, b){
		t2 *= mint(n-i);
		t2 /= mint(i+1);
	}
	ans -= t2;
	
	cout << ans.a << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+7;
int n,m,a[N],ax[N],ay[N];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	if(n==2)
	{
		printf("%d\n%d %d\n",a[2]-a[1],a[2],a[1]);
		return 0;
	}
	if(a[1]>=0)
	{
		for(int i=2;i<n;i++)ax[++m]=a[1],ay[m]=a[i],a[1]-=a[i];
		ax[++m]=a[n],ay[m]=a[1],a[n]-=a[1];
		printf("%d\n",a[n]);
		for(int i=1;i<=m;i++)printf("%d %d\n",ax[i],ay[i]);
		return 0;
	}
	if(a[n]<=0)
	{
		int ans=a[n];
		for(int i=1;i<n;i++)ans-=a[i];
		printf("%d\n",ans);
		for(int i=1;i<n;i++)printf("%d %d\n",a[n],a[i]),a[n]-=a[i];
		return 0;
	}
	int pos=0;
	for(int i=1;i<=n;i++)if(a[i]>=0){pos=i;break;}
	for(int i=2;i<pos;i++)ax[++m]=a[n],ay[m]=a[i],a[n]-=a[i];
	for(int i=pos;i<n;i++)ax[++m]=a[1],ay[m]=a[i],a[1]-=a[i];
	ax[++m]=a[n],ay[m]=a[1],a[n]-=a[1];
	printf("%d\n",a[n]);
	for(int i=1;i<=m;i++)printf("%d %d\n",ax[i],ay[i]);
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

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

map<int, int> mp;

void decomposit(int j) {
  int s = sqrt(j);
  FOR(i, 2, s) {
    while (j % i == 0) {
      mp[i]++;
      j /= i;
    }
  }
  if (j != 1) mp[j]++;
}

void solve(istream& cin, ostream& cout) {
  int n;
  cin >> n;
  mp.clear();
  FOR(i, 2, n) decomposit(i);
  int cnt_75 = 0, cnt_25 = 0, cnt_15 = 0, cnt_5 = 0, cnt_3 = 0;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    int cnt = it->second;
    if (cnt >= 74) {
      cnt_75++; cnt_25++; cnt_15++; cnt_5++; cnt_3++;
    } else if (cnt >= 24) {
      cnt_25++; cnt_15++; cnt_5++; cnt_3++;
    } else if (cnt >= 14) {
      cnt_15++; cnt_5++; cnt_3++;
    } else if (cnt >= 4) {
      cnt_5++; cnt_3++;
    } else if (cnt >= 2)
      cnt_3++;
  }
  int ans = 0;
  ans += cnt_75;
  ans += cnt_25 * (cnt_3 - 1);
  ans += cnt_15 * (cnt_5 - 1);
  ans += cnt_5 * (cnt_5 - 1) * (cnt_3 - 2) / 2;
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


Measured memory_bytes: 3636
#coding: utf-8
#a, b = map(int, input().split())
#a, b, c, x = map(int, [input() for i in range(4)])

a, b = map(int, input().split())
S = input()

if S[b - 1] == "A":
    S = S[:b - 1] + "a" + S[b:]
elif S[b - 1] == "B":
    S = S[:b - 1] + "b" + S[b:]
elif S[b - 1] == "C":
    S = S[:b - 1] + "c" + S[b:]
print(S)

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

int power(int x, int n){
  int64_t x_mod[32]; x_mod[0] = x%1000000007;
  rep(i, 31) x_mod[i+1] = (x_mod[i]*x_mod[i])%1000000007;
  bitset<32> bit(n);
  int ans = 1;
  rep(i, 32) if(bit.test(i)) ans = (ans*x_mod[i])%1000000007;
  return ans;
}

int combination(int a, int b){
  int64_t m=1, n=1;
  rep(i, b) {
    m *= a-i; m %= 1000000007;
    n *= i+1; n %= 1000000007;
  }
  n = power(n, 1000000005);
  int ans = (m*n) % 1000000007;
  return ans;
}

int main(){
  int n, a, b; cin >> n >> a >> b;
  int64_t all, nCa, nCb;
  all = power(2, n) - 1; 
  nCa = combination(n, a);
  nCb = combination(n, b);
  int64_t ans = (all - nCa - nCb + 1000000007*2)%1000000007;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;
ll ans;
vector<int> buf;
//サイトを参考にしました
void dfs(int i,const int size,const int start,const int last){
  if(i==size){
      ans+=(__gcd(buf[0],__gcd(buf[1],buf[2])));
  }
  else{
    for(int j=start;j<=last;++j){
      buf[i]=j;
      dfs(i+1,size,start,last);
    }
  }
}
int main(){
  int k;
  cin >> k;
  ans=0;
  int size=3;
  int start=1;
  int last=k;
  buf.resize(size);
  dfs(0,size,start,last);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main() {
	int m,f,r;
	while (cin >> m >> f >> r) {
		if (m == -1 && f == -1 && r == -1) {
			break;
		}
		if (m == -1 || f == -1 || m+f < 30) {
			cout << 'F' << endl;
		} else if (m+f >= 80) {
			cout << 'A' << endl;
		} else if (m+f >= 65) {
			cout << 'B' << endl;
		} else if (m+f >= 50) {
			cout << 'C' << endl;
		} else {
			if (r >= 50) {
				cout << 'C' << endl;
			} else {
				cout << 'D' << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
using namespace std;

int main() {
    long long n,m; cin >> n >> m;
    long long ans;
    ans = 0;

    bool p,q,r;

    p = (n == 1);
    q = (m == 1);
    r = ((n == 2) || (m == 2));
    
    if(p && q){
    cout << 1 << endl;
    return 0;
    }

    if(p && !q){
    cout << m - 2 << endl;
    return 0;
    }

    if(!p && q){
    cout << n - 2 << endl;
    return 0;
    }

    if(r){
    cout << 0 << endl;
    return 0;
    }

    ans = ( n - 2 ) * ( m - 2 ); 

    cout << ans << endl;

}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int n,m,a[5][105];
bool f[5][105];
int maxx;
void dfs(int x,int y,int sum)
{
    if(x<1||x>2||y<1||y>n) return;
    if(x==2&&y==n) maxx=max(maxx,sum);
    dfs(x+1,y,sum+a[x+1][y]);
    dfs(x,y+1,sum+a[x][y+1]);
}
int main()
{
    //ios::sync_with_stdio(false);
    int i,j;
    cin>>n;
    for(i=1;i<=2;i++)
    {
        for(j=1;j<=n;j++)
        {
            cin>>a[i][j];
        }
    }
    dfs(1,1,a[1][1]);
    cout<<maxx;
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main (){
  int N, K;
  cin >> N >> K;
  vector<int64_t> vec(N);
  int64_t answer = 0;
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  if(vec.size() >= K){
    answer = accumulate(vec.begin(), prev(vec.end(), K), 0LL);
  }
  cout << answer << endl;
  return 0;
}

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

int main(){
	int s;
	cin >> s;
	int left = s/100;
	int right = s % 100;
	//YYMMであるか
	if(1<= right & right <= 12){
		if(1<= left & left <= 12){
			cout << "AMBIGUOUS" << endl;
			return 0;
		}else{
			cout << "YYMM" << endl;
			return 0;
		}
	}else{
		if(1 <= left & left <= 12){
			cout << "MMYY" << endl;
			return 0;
		}else{
			cout << "NA" << endl;
			return 0;
		}
	}
	return 1;
}


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

long long n, k, a[200005], h[200005], len, tot, ju = 1;

long long jump(int n) 
{
    int o = 1;
    for (int i = 1; i <= n; ++i) 
	{
        o = a[o];
    }
    return o;
}

int main() 
{
    cin>>n>>k;
    for(int i=1;i<=n;i++) 
	{
        cin>>a[i];
    }
    if(k<=n) 
	{
        cout<<jump(k)<<endl;
        return 0;
    }
    for (int i=1;i<=k;++i) 
	{
        if (h[ju]!=0) 
		{
            len=i-h[ju];
            tot=jump(h[ju]-1+(k-h[ju]+1)%len);
            break;
        }
        h[ju]=i;
        ju=a[ju];
    }
    cout<<tot;
    return 0;
}

Measured memory_bytes: 6688
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

const double eps = 1e-2;

int main() {
    int n; cin >> n;
    vll x;
    rep(i,n) {
        double f; cin >> f;
        f *= inf;
        ll l = ll(f+eps);
        x.push_back(l);
    }
    vvint data(50,vint(50,0));
    vector<P> ct;
    rep(i,n) {
        int ct_2 = 0, ct_5 = 0;
        while (x[i] % 2 == 0) {
            ct_2++;
            x[i] /= 2;
        }
        while (x[i] % 5 == 0) {
            ct_5++;
            x[i] /= 5;
        }
        data[ct_2][ct_5]++;
        ct.push_back(P(ct_2,ct_5));
    }
    rep(i,50)rep(j,50) {
        if (i != 0) data[i][j] += data[i-1][j];
        if (j != 0) data[i][j] += data[i][j-1];
        if (i != 0 && j != 0) data[i][j] -= data[i-1][j-1];
    }
    ll ans = 0;
    rep(i,n) {
        int ct_2 = max(0,18 - ct[i].first);
        int ct_5 = max(0,18 - ct[i].second);
        int tmp = data[49][49];
        if (ct_5 != 0) tmp -= data[49][ct_5-1];
        if (ct_2 != 0) tmp -= data[ct_2-1][49];
        if (ct_5 != 0 && ct_2 != 0) tmp += data[ct_2-1][ct_5-1];
        if (ct_2 <= ct[i].first && ct_5 <= ct[i].second) tmp--;
        ans += tmp;
    }
    ans /= 2;
    cout << ans << endl;
}

Measured memory_bytes: 8044
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		double[] v = new double[N];
		for( int i=0; i<N; i++ ){
			v[i] = sc.nextDouble();
		}
		Arrays.sort(v);
		for( int i=1; i<N; i++ ){
			v[i] = (v[i]+v[i-1])/2;
		}
		System.out.println(v[N-1]);
	}
}


Measured memory_bytes: 23508
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll A,V,B,W,T;
    cin >> A >> V >> B >> W >> T;
    ll diff = V - W;
    if(diff <= 0){
        print("NO");
    }else{
        ll d = diff * T;
        ll d2 = abs(A - B);
        if(d2 <= d){
            print("YES");
        }else{
            print("NO");
        }
    }

    

}

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

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

int q(const int *a,const int *b)
{
	return *a-*b;
}

int main(void)
{
	int d[3];
	scanf("%d%d%d",&d[0],&d[1],&d[2]);
	qsort(d,3,4,q);
	printf("%d %d %d\n",d[0],d[1],d[2]);
	return 0;
}


Measured memory_bytes: 2040
#include <iostream> 
#include <vector>
#include <cstring>
#include <algorithm>


int main() {
	using namespace std;
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n, m;
	cin >> n >> m;
	
	vector<vector<int>> dp(n + 1, vector<int> (10,-1e9));
	vector<int> mapped = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
	vector<int> v(m);
	for (int i = 0; i < m; ++i) {
		cin >> v[i];
	}
	
	for (int i = 0; i < 10; ++i) dp[0][i] = 0;
	
	for (int i = 0; i < m; ++i) {
		for (int j = 0; j <= n; ++j) {
			int x = mapped[v[i]];
			if (j >= x) {
				if (1 + dp[j - x][0] >= dp[j][0]) {
					if (1 + dp[j - x][0] > dp[j][0]) {
						dp[j] = dp[j - x];
						dp[j][0]++;
						dp[j][v[i]]++;
					}else {
						vector<int> d1 = dp[j - x];
						d1[0]++;
						d1[v[i]]++;
						vector<int> d2 = dp[j];
						reverse(d1.begin(), d1.end()); 
						reverse(d2.begin(), d2.end()); 
						if (d1 > d2) {
							reverse(d1.begin(), d1.end());
							dp[j] = d1;
						} 
					}
				}
			}
		} 
	}
	
	for (int i = 9; i > 0; --i) {
		for (int j = 0; j < dp[n][i]; ++j) {
			cout << i;
		}
	}
}








Measured memory_bytes: 4104
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const ll MOD=1e9+7;
const int INF=1e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false); 

    int n;
    cin >> n;
    ll ans=1;
    vector<int> cnt(3);
    rep(i,n) {
        int a;
        cin >> a;
        ll d=0;
        bool flag=1;
        rep(i,3) {
            if (cnt[i]==a) {
                if (flag) {
                    ++cnt[i];
                    flag=0;
                }
                ++d;
            }
        }
        ans=(ans*d)%MOD;
    }
    cout << ans << endl;

    return 0;
}


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

shougen = []

for i in range(N):
    A = int(input())
    shougen.append([])
    for i in range(A):
        x, y = map(int, input().split())
        shougen[-1].append((x-1, y))


m = 0
for i in range(2 ** N):
    flag = True
    for j in range(N):
        if (i >> j) & 1 == 1:
            for shou in shougen[j]:
                if shou[1] != (i >> shou[0]) & 1:
                    flag = False

    if flag:
        wa = 0
        for j in range(N):
            wa += (i >> j) & 1
        m = max(m, wa)

print(m)


Measured memory_bytes: 42604
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define chmax(x, y) x = max(x, y)

int items[3001][3001];
ll dp[3001][3001][4];

int main() {
  int R, C, K;
  cin >> R >> C >> K;
  rep(i, K) {
    int r, c, v;
    cin >> r >> c >> v;
    items[r-1][c-1] = v;
  }

  rep(i, R) rep(j, C) {
    for (int k = 2; k >= 0; --k) {
      chmax(dp[i][j][k+1], dp[i][j][k] + items[i][j]);
    }
    rep(k, 4) {
      chmax(dp[i][j+1][k], dp[i][j][k]);
      chmax(dp[i+1][j][0], dp[i][j][k]);
    }
  }

  ll ans = 0;
  rep(k, 4) chmax(ans, dp[R-1][C-1][k]);
  cout << ans << endl;
  return 0;
}

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

int main(){
    long long A, V, B, W, T;
    std::cin >> A >> V >> B >> W >> T;
    
    long long V_diff = V - W;
    if(V_diff <= 0){
        std::cout << "NO" << std::endl;
        return 0;
    }

    long long dist = V_diff * T;
    if(std::abs(A-B) > dist){
        std::cout << "NO" << std::endl;
    }else{
        std::cout << "YES" << std::endl;
    }

    return 0;
}



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

int w, h;
char c[51][51];

void dfs(int x, int y) {
	c[x][y] = 0;
	for (int i = -1; i <= 1; i++) {
		for (int j = -1; j <= 1; j++) {
			int nx = x + i, ny = y + j;
			if (0 <= nx&&nx < h && 0 <= ny&&ny < w&&c[nx][ny])
				dfs(nx, ny);
		}
	}
}
int main() {
	while (scanf("%d%d", &w, &h), w) {
		rep(i, h)rep(j, w)scanf("%d", &c[i][j]);
		int cnt = 0;
		rep(i, h)rep(j, w) {
			if (c[i][j]) {
				dfs(i, j);
				cnt++;
			}
		}
		printf("%d\n", cnt);
	}
}

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

typedef struct node {
  char key[11];
  struct node *next;
  struct node *prev;
} Node;

int main(){
  int i;
  char key[11];
  Node nil, *np;
  char buf[32];
  fgets(buf, 32, stdin);
  Node *pool = (Node*)malloc(sizeof(Node)*1500000);
  int plen=0;

  nil.next = nil.prev = &nil;
  
  while (fgets(buf, 32, stdin)) {
    if (buf[0]=='i') { // insert key
      for (i=0; buf[i+7]!='\n'; pool[plen].key[i]=buf[i+7],i++);
      pool[plen].key[i]=0;
      pool[plen].prev = &nil;
      pool[plen].next = nil.next;
      nil.next = nil.next->prev = &pool[plen];
      plen++;
    } else if (*buf == 'd') {
      if (buf[6] != ' ') {
	if (buf[6] == 'F') { //deleteFirst();
	  if (nil.next!=&nil) {
	    np = nil.next;
	    np->prev->next = np->next;
	    np->next->prev = np->prev;
	  }
	} else {//if (buf[6] == 'L') {// deleteLast();
	  if (nil.prev!=&nil) {
	    np = nil.prev;
	    np->prev->next = np->next;
	    np->next->prev = np->prev;
	  }
	}
      } else { // delete x
	for (i=0; buf[i+7]!='\n'; key[i]=buf[i+7],i++);
	key[i]=0;
	for (np=nil.next; np!=&nil; np=np->next) {
	  if (strcmp(np->key,key)==0) {
	    np->prev->next = np->next;
	    np->next->prev = np->prev;
	    break;
	  }
	}
      }
    }
  }

  np = nil.next;
  if (np!=&nil) fputs(np->key, stdout);
  for (np=np->next; np!=&nil; np=np->next) {
    putc_unlocked(' ', stdout);
    fputs(np->key, stdout);
  }
  putc_unlocked('\n', stdout);
  return 0;
}



Measured memory_bytes: 36040
from collections import *
from itertools import *
from bisect import *
import copy

n,k=map(int,input().split())
mod=10**9+7
fac=[0,1]
for i in range(2,2*n+1):
    fac.append(fac[i-1]*i%mod)
ifac=[pow(i,mod-2,mod) for i in fac]

def comb(a,b):
    if a>=0 and b==0:return(1)
    if a<b or a<0:return(0)

    return((fac[a]*ifac[a-b]*ifac[b])%mod)

count=1
for m in range(1,min(k+1,n)):

    count=(count+comb(n,m)*comb(n-1,n-m-1))%mod
print(count)


Measured memory_bytes: 74284
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include <string.h>
using namespace std;
int main(){
	while(1){
		int n,m;
		string x,y;
		cin>>n;
		if(n==0)break;
		vector<string> hoge1,hoge2;
		for(int i=0;i<n;i++){
			cin>>x>>y;
			hoge1.push_back(x);
			hoge2.push_back(y);
			//cout<<x<<y<<endl;
		}
		cin>>m;
		for(int i=0;i<m;i++){
			cin>>x;
			bool flag=false;
			for(int j=0;j<n;j++){
				if(x==hoge1[j]){
					cout<<hoge2[j];
					flag=true;
				}
			}
			if(!flag)cout<<x;
		}
		cout<<endl;
	}
	
	return 0;
	
}

Measured memory_bytes: 1208
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define re register
#define mp make_pair
#define clear(x,y) memset(x,y,sizeof(x))
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=200000+10;

int n,x[2][N];
pair<int,int> a[N];

struct edge { int v,nxt; } e[N*10];
int head[N],ecnt=0;
inline void addEdge(int u,int v) {
    e[++ecnt]=(edge){v,head[u]},head[u]=ecnt;
}

#define ls (o<<1)
#define rs (o<<1|1)
int ncnt,id[N];
inline void build(int o,int l,int r) {
    if (l==r) { id[o]=a[l].second; return; }
    id[o]=++ncnt; int mid=(l+r)>>1;
    build(ls,l,mid),build(rs,mid+1,r);
    addEdge(id[o],id[ls]),addEdge(id[o],id[rs]);
}
inline void link(int o,int l,int r,int ql,int qr,int u) {
    if (ql>qr) return;
    if (ql<=l&&r<=qr) { addEdge(u,id[o]); return; }
    int mid=(l+r)>>1;
    if (ql<=mid) link(ls,l,mid,ql,qr,u);
    if (qr>mid) link(rs,mid+1,r,ql,qr,u);
}
#undef ls
#undef rs

int dfn[N],low[N],tim=0,bl[N],scc=0,sta[N],in[N],top=0;
inline void tarjan(int u) {
    dfn[u]=low[u]=++tim,sta[++top]=u,in[u]=1;
    for (re int i=head[u];i;i=e[i].nxt) {
        int v=e[i].v;
        if (!dfn[v]) tarjan(v),low[u]=min(low[u],low[v]);
        else if (in[v]) low[u]=min(low[u],dfn[v]);
    }
    if (dfn[u]==low[u]) { ++scc;
        while (233) {
            int t=sta[top--]; bl[t]=scc,in[t]=0;
            if (t==u) break;
        }
    }
}

inline int check(int mid) {
    clear(head,0),ecnt=0;
    clear(dfn,0),clear(low,0),clear(bl,0),clear(in,0),tim=scc=top=0;
    ncnt=n<<1,build(1,1,n<<1);
    for (re int i=1;i<=n;++i)
        for (re int j=0;j<2;++j) {
            int l=lower_bound(a+1,a+n+n+1,mp(x[j][i]-mid+1,0))-a;
            int r=upper_bound(a+1,a+n+n+1,mp(x[j][i]+mid-1,n<<1|1))-a-1;
            int m=lower_bound(a+1,a+n+n+1,mp(x[j][i],i+(j^1)*n))-a;
            link(1,1,n<<1,l,m-1,i+j*n),link(1,1,n<<1,m+1,r,i+j*n);
        }
    for (re int i=1;i<=ncnt;++i) if (!dfn[i]) tarjan(i);
    for (re int i=1;i<=n;++i) if (bl[i]==bl[i+n]) return 0;
    return 1;
}

int main() {
    n=read();
    for (re int i=1;i<=n;++i) {
        x[0][i]=read(),x[1][i]=read();
        a[i]=mp(x[0][i],i+n),a[i+n]=mp(x[1][i],i);
    }
    sort(a+1,a+n+n+1);
    int L=0,R=1e9;
    while (L<R) {
        int mid=(L+R+1)>>1;
        if (check(mid)) L=mid;
        else R=mid-1;
    }
    printf("%d\n",L);
    return 0;
}


Measured memory_bytes: 14720
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

constexpr int INF = 1e8;
constexpr int MOD = 1e9+7;
constexpr int ESP = 1e-9;
constexpr double PI = acos(-1);

ll f(ll n, ll x) {
    if (x % (n-x) == 0) return x * 3;
    else {
        ll nextx = n-x - x % (n-x);
        ll ret = x + (x / (n-x) * 2 + 1) * (n-x) + x % (n-x) + f(n-x,nextx) - nextx;
        return ret;
    }
}

int main(void) {
    ll n, x;
    cin >> n >> x;
    cout << f(n,x) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  char s[7];
  int i;
  scanf("%s",s);
  for(i=0; i<7; i++)
  {
    if(s[2]==s[3] && s[4]==s[5])
    {
        printf("Yes\n");
        break;
        
    }
    else 
        {
            printf("No\n");
            break;
        }
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
char f[1000000000]={};
int a,n,i;
int main(){
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a);
        if(f[a]){puts("NO");return 0;}
        f[a]=1;
    }
    puts("YES");
    return 0;
}

Measured memory_bytes: 975360
import bisect
import heapq
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N, M = map(int, input().split())
        hq = []
        for c in input().split():
            heapq.heappush(hq, -1 * int(c))

        for _ in range(M):
            heapq.heappush(hq, int(heapq.heappop(hq) / 2))

        print(-1 * sum(hq))


# Run main
if __name__ == '__main__':
    AtCoder().main()


Measured memory_bytes: 59760
W,H,N=map(int,input().split())
X=[w for w in range(W+1)]
Y=[h for h in range(H+1)]
for n in range(N):
    w,h,a=map(int,input().split())
    if a==1:
        X=[x for x in X if x>=w]
    elif a==2:
        X=[x for x in X if x<=w]
    elif a==3:
        Y=[y for y in Y if y>=h]
    else:
        Y=[y for y in Y if y<=h]
if len(X)<2 or len(Y)<2:
  print(0)
else:
  print((len(X)-1)*(len(Y)-1))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define M_PI  3.1415926535
#define ll long long
#define ld long double
#define Summon_Tourist ios::sync_with_stdio(false);cin.tie(0);
ll gcd(ll a , ll b) { return b==0?a: gcd( b, a%b); }
ll lcm(ll a , ll b) { return a/gcd(a,b) * b ; }
ll inf = 1e9 + 7;
ll modexp( ll base ,ll power)
 {
     if( power == 0  ) return 1;
     if( power & 1) return base*modexp( base , power-1 )%inf;
     return modexp(base*base%inf,power/2);
 }
// -----------------------------------------------CKMKB-----------------------------------------------------------
// -----------------------------------------------PKMKB-----------------------------------------------------------
ll n,k;
ll check( ll x , ll y ) { return (x<n && y<n); }
vector<pair<ll,ll > > func( ll r , ll c )
{
    vector<pair<ll,ll > > temp ;
    while( check(r,c) )
    {
        temp.push_back( make_pair(r,c) ) ;
        r++;c++;
    }
    return temp;
}
 int main()
{
  Summon_Tourist
  //freopen("input.txt" , "r" , stdin ) ;
  ll t = 1;
  //cin>>t;
  while(t--)
  {
        ll k,a,b;
        cin>>k>>a>>b;
        ll c ;
        if( a%k != 0)
        c = k - (a%k) ;
        else c = 0 ;
        if( a + c <=b ) cout<<"OK\n";
        else cout<<"NG\n";
  }
  return 0;

}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define mem(s,t) memset(s,t,sizeof(s))
#define pb(s) push_back(s)
#define inf 0x3f3f3f3f
#define mn 100010
typedef long long ll;
using namespace std;

ll n,k,a[200010],f[200010];

bool cmp(ll x,ll y)
{
    return x>y;
}

bool check(ll p)
{
    ll sum=0,i;
    for (i=1;i<=n;i++)
        sum+=a[i]-min(a[i],p/f[i]);
    return sum<=k;
}

int main()
{
    ll l,r,mid,i;
    scanf("%lld%lld",&n,&k);
    for (i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    for (i=1;i<=n;i++)
        scanf("%lld",&f[i]);
    sort(a+1,a+n+1);
    sort(f+1,f+n+1,cmp);
    l=0; r=1e12;
    while (l!=r)
    {
        mid=(l+r)/2;
        if (check(mid)) r=mid;
        else l=mid+1;
    }
    printf("%lld\n",l);
    return 0;
}



Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define loop(n, i) for(int i=0;i<n;i++)
#define loop1(n, i) for(int i=1;i<=n;i++)
#define rloop(n, i) for(int i=n;i;i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;

const int MAX = 5000 * 5100;
ll G[2][3];
ll dp[MAX];

int main() {
    int n; cin >> n;
    loop (2, i) loop (3, j) cin >> G[i][j];

    fill(dp, dp + MAX, 0);
    loop (n, i) {
        dp[i + 1] = max(dp[i + 1], dp[i] + 1);
        loop (3, j) {
            int k = i + G[0][j];
            dp[k] = max(dp[k], dp[i] + G[1][j]);
        }
    }

    int m = dp[n];
    fill(dp, dp + MAX, 0);
    loop (m, i) {
        dp[i + 1] = max(dp[i + 1], dp[i] + 1);
        loop (3, j) {
            int k = i + G[1][j];
            dp[k] = max(dp[k], dp[i] + G[0][j]);
        }
    }

    cout << dp[m] << endl;
    return 0;
}



Measured memory_bytes: 199552