akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>

using namespace std;
int n, k, x;
unsigned long long ans;
int b[200001]; // 10^6
vector<int> v;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    b[x]++;
  }
  for (int i = 0; i < 200001; i++) {
    if (b[i] > 0) {
      v.push_back(b[i]);
    }
  }
  int size = v.size();
  sort(v.begin(), v.end());
  int p = 0;
  while (size > k) {
    ans += v[p++];
    size--;
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 2168
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<string>
#include<cmath>
#include<cassert>
#include<cstdint>
#include<map>
using namespace std;

typedef int64_t i64;typedef int32_t i32;
typedef int16_t i16;typedef int8_t i8;
typedef uint64_t ui64;typedef uint32_t ui32;
typedef uint16_t ui16;typedef uint8_t ui8;

typedef i64 int__;
#define rep(i,j) for(int__ i=0;i<j;i++)
#define repeat(i,j,k) for(int__ i=(j);i<(k);i++)
#define all(v) begin(v),end(v)

const i32 INF=1<<30;//10E10

int P,Q,A,N;
double PpQ;
int dfs(i64 sum_u,i64 sum_d,int i,int a,int n){
  //printf("u:%lld d:%lld i:%d a:%d n:%d\n",sum_u,sum_d,i,a,n);
  if(P*sum_d==Q*sum_u)return 1;
  if(n<=0)return 0;
  int ret=0;
  while(i*a<=A){
    int u=sum_u*i+sum_d;
    int d=sum_d*i;
    if(P*d>=Q*u and Q*(n*d+u*i)>=P*d*i)
      ret+=dfs(u,d,i,i*a,n-1);
    i++;
  }
  return ret;
}


int main()
{
  while(true){
    cin>>P>>Q>>A>>N;
    if(Q==0)break;
    PpQ=(double)P/Q;
    cout<<dfs(0,1,1,1,N)<<endl;
  }
  return 0;
}

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

int main(){
	string s;
	cin >> s;
	for(int i=1; i<s.length(); i++){
		if(s[i-1] == s[i]){
			cout << "Bad" << endl;
			return 0;
		}
	}
	cout << "Good" << endl;
}

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

long long dfs(vector<vector<long long>>& problems, int interupt, int i, int num_solved, int score, int target)
{
    if(score >= target)
        return num_solved;
    if(i == problems.size())
        if(interupt != -1 && (int)ceil((double)(target - score) / ((interupt+1) * 100)) <= problems[interupt][0]){
            return num_solved + (int)ceil((double)(target - score) / ((interupt+1) * 100));
        }
        else
            return 1000000;

    long long min_num_solved = 1000000;
    min_num_solved = min(min_num_solved, dfs(problems, interupt, i+1, num_solved+problems[i][0], score+problems[i][0]*(i+1)*100+problems[i][1], target));
    min_num_solved = min(min_num_solved, dfs(problems, interupt, i+1, num_solved, score, target));
    
    if(interupt == -1){
        interupt = i;
        min_num_solved = min(min_num_solved, dfs(problems, interupt, i+1, num_solved, score, target));
        interupt = -1;
    }
    
    return min_num_solved;
}

int main(void){
    // Your code here!
    long long d, g;
    vector<vector<long long>> problems;
    
    cin >> d >> g;
    for(int i = 0; i < d; i++){
        vector<long long> temp{0, 0};
        cin >> temp[0] >> temp[1];
        problems.push_back(temp);
    }

    cout << dfs(problems, -1, 0, 0, 0, g) << endl;
}


Measured memory_bytes: 256
/*
                                             ::                     ::
                                             ':                     :
                                              :.                    :
                                           ;' ::                   ::  '
                                          .'  ';                   ;'  '.
                                         ::    :;                 ;:    ::
                                         ;      :;.             ,;:     ::
                                         :;      :;:           ,;"      ::
                                         ::.      ':;  ..,.;  ;:'     ,.;:
                                          "'"...   '::,::::: ;:   .;.;""'
                                              '"""....;:::::;,;.;"""
                                          .:::.....'"':::::::'",...;::::;.
                                         ;:' '""'"";.,;:::::;.'""""""  ':;
                                        ::'         ;::;:::;::..         :;
                                       ::         ,;:::::::::::;:..       ::
                                       ;'     ,;;:;::::::::::::::;";..    ':.
                                      ::     ;:"  ::::::"""'::::::  ":     ::
                                       :.    ::   ::::::;  :::::::   :     ;
                                        ;    ::   :::::::  :::::::   :    ;
                                         '   ::   ::::::....:::::'  ,:   '
                                          '  ::    :::::::::::::"   ::
                                             ::     ':::::::::"'    ::
                                             ':       """""""'      ::
                                              ::                   ;:
                                              ':;                 ;:"


                                                     P_r_A_d_Y
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define mod 1000000007
#define inf 1e18
const int N = 300005;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
void cs(int &x)
{
    cout << "Case #" << x << ": ";
}
bool cmp(string a, string b)
{
    return a + b < b + a;
}

int32_t main()
{
    fastIO;
    // int t; cin >> t;
    // int x = 1;
    // while (t--)
    // {

    int x;
    cin>>x;

    int fl=-1;

    if(x==1)
        {cout<<0<<" "<<-1<<endl;return 0;}

    for(int i=1;i<=sqrt(x);i++)
    {
        if(x%i==0)
        {
            for(int j=-300;j<=300;j++)
            {
                for(int u=-300;u<=300;u++)
                {
                    if(j-u==i && (j*j*j*j + j*j*j*u + j*j*u*u + j*u*u*u + u*u*u*u)==x/i)
                        {cout<<j<<" "<<u<<endl;fl++;break;}
                }
                if(fl!=-1)
                    break;
            }
        }
        if(fl!=-1)
            break;
    }



    //}
    return 0;
}

Measured memory_bytes: 3684
def LI(): return [int(x) for x in input().split(" ")]
def LS(): return [str(x) for x in input().split(" ")]
def ItoS(L): return [str(x) for x in L]
def StoI(L): return [int(c) for c in L]


def solve():
    w, h, n = LI()
    X, Y, A = [], [], []
    for _ in range(n):
        tmp1, tmp2, tmp3 = LI()
        X.append(tmp1)
        Y.append(tmp2)
        A.append(tmp3)

    field = [[1 for _ in range(w)] for __ in range(h)]

    for i, a in enumerate(A):
        if a == 1:
            for j in range(X[i]):
                for k in range(h):
                    field[k][j] = 0
        elif a == 2:
            for j in range(X[i], w):
                for k in range(h):
                    field[k][j] = 0
        elif a == 3:
            for j in range(Y[i]):
                for k in range(w):
                    field[j][k] = 0
        elif a == 4:
            for j in range(Y[i], h):
                for k in range(w):
                    field[j][k] = 0
        else:
            pass
        
    ans = 0
    for ele in field:
        ans += ele.count(1)

    print(ans)


solve()

Measured memory_bytes: 3188
#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 n;
vector<pair<ll,ll> >v;
ll done[MAX],dp[MAX];

ll solve(ll i){
  if(i == n){
    return 0;
  }
  if(done[i])return dp[i];
  ll r = v[i].second;
  auto it = upper_bound(all(v),mp(r,-INF));
  auto j = distance(v.begin(),it);
  // cout<<" 1 "<<i<<' '<<j<<'\n';
  ll ans = max(1+solve(j),solve(i+1));
  // cout<<" 2 "<<i<<' '<<j<<'\n';
  done[i] = 1;
  return dp[i] = ans;
}

int main(){FAST;
cin>>n;
for(int i=1;i<=n;++i){
  ll x,l;cin>>x>>l;
  v.pb({x-l,x+l});
}
sort(all(v));
cout<<solve(0);
return 0;
}   

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

void fast(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
}

int main(){
    fast();
    ll n,k;
    cin>>n>>k;
    if(n>=10)cout<<k;
    else{
    	cout<<k+(10-n)*100;
	}
}

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

#define int long long


using namespace std;





vector<int> div(int N){
    vector<int> ret;
    for(int i=1;i*i<=N;i++){
        if(N%i==0){
            ret.push_back(i);
            if(i*i!=N) ret.push_back(N/i);
        }
    }
    return (ret);
}


signed main(){
    int N;
    cin >> N;
    int a[N];
    bool zero = true;
    for(int i=0;i<N;i++){
        cin >> a[i];
        if(a[i]==1){
            zero = false;
        }
    }
    reverse(a,a+N);
    vector<int> ans;
    vector<int> count(200005,0);

    for(int i=0;i<N;i++){
        if(count[N-i]%2==a[i]){

        }else{
            vector<int> yakusu = div(N-i);
            for(int j=0;j<yakusu.size();j++){
                count[yakusu[j]]++;
            }
            ans.push_back(N-i);
        }
    }

    cout << ans.size() << endl;
    for(int i=0;i<ans.size();i++){
        cout << ans[i] << endl;
    }

}

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

#define ll long long
#define ull unsigned long long 
#define endl '\n'
#define pii pair<int, int>
#define all(a) a.begin(),a.end()

int main(){
    ll t;
    cin >> t;
    vector<ll> d(5, 0);
    while(t--){
        string s;
        cin>>s;
        if(s[0]=='M')
            d[0]++;
        if(s[0]=='A')
            d[1]++;
        if(s[0]=='R')
            d[2]++;
        if(s[0]=='C')
            d[3]++;
        if(s[0]=='H')
            d[4]++;
    }
    
    ll ans=0; 
 
    for(int i=0; i<5; ++i){
        for(int j=i+1; j<5; ++j){
            for(int k=j+1; k<5; ++k)
                ans += d[i]*d[j]*d[k];
        }
    }
    cout << ans;
}


Measured memory_bytes: 3628
def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    X = ii()
    l = []
    for b in range(1, 1001):
        if b == 1:
            l.append(1)
            continue
        a = b*b
        while a <= X:
            l.append(a)
            a *= b
    print(max(l))

if __name__ == '__main__':
    main()

Measured memory_bytes: 62040
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
     double r,pi,s,l;
     Scanner sc = new Scanner(System.in); 
         r =   sc.nextDouble();
     pi = Math.PI;
     s = r*r*pi;
     l = 2*r*pi;
     System.out.printf("%f %f\n",s,l);
    }
}


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

int main() {
 int N , K , x;
 x = 1;
 cin >> N >> K;
 for (int i = 0; i < N; i++) {
   if ( x < K ) {
     x *= 2;
   }
   else {
     x += K;
   }
 }
  cout << x << endl;
}

Measured memory_bytes: 3636
x1,y1,x2,y2 = map(int,input().split())
x3,y3 = x2 - (y2-y1), y2 + x2-x1
x4,y4 = x1 - (y2-y1), y1 + x2-x1

ans = [x3,y3,x4,y4]
print(*ans)

Measured memory_bytes: 9096
from collections import defaultdict

def main():
    num, d = map(int, input().split())
    data = [list(map(int, input().split())) for i in range(num)]
    ans = 0
    for i in range(num):
        for j in range(i + 1, num):
            a = data[i]
            b = data[j]
            kari = 0
            for k in range(d):
                kari += (a[k] - b[k]) ** 2
            kari_s = int(kari ** 0.5)
            if kari == kari_s ** 2:
                ans += 1
    print(ans)






if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
/*
ID: C4551DY
TASK: dualpal
LANG: C++14
*/
/*  CF_CC
        4U7H0R:_C4551DY */

#include <bits/stdc++.h>
#include <fstream>

using namespace std;

#define IC ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(a,b,c) for(ll a=b;a<c;a++)
#define lb lower_bound
#define ll long long
#define pii pair<int,int>
#define vec vector<ll>
#define fir first
#define sec second
#define pb push_back

const int mxi=1e7+7;
const int mod=1e9+7;

float n;


int main(){
	IC
    //ofstream cout ("dualpal.out");
    //ifstream cin ("dualpal.in");
    cin >> n;
    cout.precision(6);
    cout << std::fixed;
    cout << (n/3)*(n/3)*(n/3);
}


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

int main() {
	string s;cin>>s;
	vector<int> v(s.size());
	int k;cin>>k;
	for(int i=0;i<s.size();i++){
		v[i]=(26-s[i]+'a')%26;
		if(i==s.size()-1){
			int add=(s[i]-'a'+k)%26;
			s[i]='a'+add;
			k=-1;
		}
		if(v[i]<=k){
			k-=v[i];
			s[i]='a';
		}
		cout<<s[i];

	}
	cout<<endl;

	return 0;
}


Measured memory_bytes: 1024
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int dp2[3][25000000];

int solve(){
  int n;cin>>n;
  int a[3];cin>>a[0]>>a[1]>>a[2];
  int b[3];cin>>b[0]>>b[1]>>b[2];
  dump_1d(a, 3);
  dump_1d(b, 3);

  int v[3];
  rep(i, 3){
    v[i] = b[i]-a[i];
  }

  int dp[3][5001];
  rep(i,3)rep(j,5001)dp[i][j]=-INF;
  dp[0][0] = 0;
  dp[1][0] = 0;
  dp[2][0] = 0;

  int x;
  x = 1;
  if (v[0]>0){
    while(a[0]*x<=n){
      chmax(dp[0][a[0]*x], v[0]*x);
      x++;
    }
  }

  rep(i, 1, 3){
    rep(w, n+1){
      x = 0;
      while (w-a[i]*x>=0){
        chmax(dp[i][w], dp[i-1][w-a[i]*x]+v[i]*x);
        x++;
      }
    }
  }
  dump_1d(dp[0], 25);
  dump_1d(dp[1], 25);
  dump_1d(dp[2], 25);

  int nn = 0;
  rep(i, n+1) {
    chmax(nn, dp[2][i]);
  }
  nn += n;
  dump(nn);


  // 2回目
  n = nn; // ~25000000
  rep(i, 3){
    v[i] = a[i]-b[i];
  }

  rep(i, 3)rep(j, n+1) dp2[i][j]=-INF;
  dp2[0][0]=0;
  dp2[1][0]=0;
  dp2[2][0]=0;

  x = 1;
  if (v[0]>0){
    while(b[0]*x<=n){
      chmax(dp2[0][b[0]*x], v[0]*x);
      x++;
    }
  }

  rep(i, 1, 3){
    rep(w, n+1){
      chmax(dp2[i][w], dp2[i-1][w]);
      if (w-b[i]>=0) chmax(dp2[i][w], dp2[i-1][w-b[i]]+v[i]);
      if (w-b[i]>=0) chmax(dp2[i][w], dp2[i][w-b[i]]+v[i]);
    }
  }
  dump_1d(dp2[0], 55);
  dump_1d(dp2[1], 55);
  dump_1d(dp2[2], 55);
  int r=0;
  rep(i, n+1) chmax(r, dp2[2][i]);
  cout << n + r << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 586368
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
vector<int> vec; // int型の配列変数vecを宣言
 
  vec = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 }; // 25, 100, 64 という整数(int)の列を代入
 
 int num=0;
 cin >> num;
  cout << vec.at(num-1) << endl; // 1つめである25を出力

 
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import math

def solve(X: int):
    lim = 200

    for A in range(-lim, lim):
        for B in range(-lim, lim):
            x = math.pow(A, 5) - math.pow(B, 5)
            if X == int(x):
                print(A, B)
                return
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


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

#ifndef LOCAL
#define cerr dolor_sit_amet
#endif

#define mp make_pair
#define sz(x) ((int)((x).size()))
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int , int > ipair;
typedef pair < ll , ll > lpair;
const int IINF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const double DINF = numeric_limits<double>::infinity();
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int DX[] = { 1,  0, -1,  0,  1, -1,  1, -1};
const int DY[] = { 0,  1,  0, -1,  1, -1, -1,  1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll sqr(ll x) { return x*x; } ll sqr(int x) { return (ll)x*x; }
double sqr(double x) { return x*x; } ld sqr(ld x) { return x*x; }
mt19937 mmtw(960172);
ll rnd(ll x, ll y) { static uniform_int_distribution<ll> d; return d(mmtw) % (y - x + 1) + x; }

// ========================================================================= //

const int N = 100179;

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

    int n;
    cin >> n;
    while (true) {
        ll s = 0;
        vector<int> ans;
        int g = 0;
        for (int i = 2; sz(ans) < n; ++i)
            if (rand() % (n < 10000 ? 3 : 15) && (i % 2 == 0 || i % 3 == 0 || i % 5 == 0)) {
                ans.push_back(i);
                s += i;
                if (g == 0)
                    g = i;
                else
                    g = __gcd(g, i);
            }
        if (s % 30 == 0 && g == 1 && ans.back() <= 30000) {
            for (int x : ans)
                cout << x << " ";
            cout << "\n";
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 1156
#include <iostream>
#include <ostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>

using namespace std;

int main()
{
    int a, b;

    string s, t;

    cin >> a >> b;

    for (int i = 0; i < a; i++) {
        s += to_string(b);
    }
    for (int i = 0; i < b; i++) {
        t += to_string(a);
    }

    if (s > t) {
        cout << t << endl;
    }
    else {
        cout << s << endl;
    }

}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

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

	a, b := nextInt(), nextInt()

	fmt.Println((a + b + 1) / 2)
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;

namespace IMissYou
{
    class Program
    {
        static void Main(string[] args)
        {
            string inputNumbers = Console.ReadLine();
            long inputNum = Convert.ToInt64(inputNumbers);
            var input = Console.ReadLine().Split(' ');

            List<long> inputs = new List<long>();
            
            for(int i = 0; i < inputNum; i++)
            {
                inputs.Add(Convert.ToInt64(input[i]));
            }

            var distinctNumbers = inputs.Distinct();

            if(distinctNumbers.Count() == inputs.Count())
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }

            
        }
    }
}

Measured memory_bytes: 47944
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
    ll n;
  cin>>n;
  ll t=n,f=0;
  while(t)
  {
  ll r=t%10;
    if(r==7)
    {
      f=1;break;}
    t=t/10;
  }

      if(f==1)
      {cout<<"Yes";}
  else
  {cout<<"No";}
      
      
      
return 0;}

Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <vector>
#include <bits/stdc++.h>
#include <math.h>
#include <stack>
#define pb push_back
// #define pop pop_back
#define ll unsigned long long int
#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep2(i, a, b) for (ll i = a; i <= b; i++)
#define repr(i, a, b) for (ll i = a; i >= b; i--)
#define I long_max
#define pii pair<int, int>
#define pll pair<long, long>
#define vpair vector<pair<int, int>>
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define fir first
#define sec second
#define d (int)1e9 + 7
#define INF (int)2e9 + 1
#define el "\n"
#define fs fastscan

#define vrep(vec) for (const auto &value : vec)
#define arep(arrat) for (const auto &value : array)
using namespace std;

bool sortinrev(const pair<int, int> &a,
               const pair<int, int> &b)
{
    return (a.first > b.first);
}
void swap(int *a, int *b)
{
    int temp;
    temp = *a;
    *a = *b;
    *b = temp;
}

//over

bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}

int dfs(int n, vector<vector<int>> &adj, vector<bool> &check, vector<vector<ll>> &final1, int last)
{
    // if (n == target)
    // {
    //     check[target] = true;
    //     return final;
    // }
    for (int j = 0; j < adj[last].size(); j++)
    {
        if (adj[last][j] != 0 && !check[j])
        {
            check[j] = true;
            final1[n][j] = final1[n][last] + adj[last][j];
            dfs(n, adj, check, final1, j);
        }
        // if (check[target])
        // {
        //     return a;
        // }
    }
    return 0;
}

int main()
{
    std::ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //use auto instead of data types
    // int t;
    // cin >> t;
    // while (t--)
    {
        ll n, w;
        cin >> n >> w;
        vector<pair<ll, ll>> a(n);
        rep(i, n)
        {
            cin >> a[i].first >> a[i].second;
        }
        vector<vector<ll>> dp(n+1, vector<ll>(w + 1, 0));
        for (int i = 1; i <= n; i++)
        {
            for (int j = 0; j <= w; j++)
            {
                if (a[i-1].first <= j){
                    dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a[i-1].first] + a[i-1].second);
                }
                else
                {
                    dp[i][j] = dp[i-1][j];
                }
            }
        }
        cout << dp[n][w] << endl;
    }
    return 0;
}


Measured memory_bytes: 83088
#include<stdio.h>
#include<string.h>
int main(void)
{
	int a[5],b[5],d,i,j;
	char c[6]="ABCDE";
	scanf("%d %d",&a[0],&b[0]);
	while(a[0]!=0 && b[0]!=0){
		j=0; d=a[0]+b[0];
		for(i=1;i<5;i++){
			scanf("%d %d",&a[i],&b[i]);
			if(a[i]+b[i]>d){
				d=a[i]+b[i]; j=i;
			}
		}
		printf("%c %d\n",c[j],d);
		scanf("%d %d",&a[0],&b[0]);
	}
	return 0;
}

Measured memory_bytes: 2584
from collections import Counter
from sys import stdin

def main():
    N = int(input())
    A = map(int, input().split())

    cnt = Counter(A).most_common()
    n = N // 3
    l = len(cnt)
    if l == 1:
        if cnt[0][0] == 0:
            print('Yes')
        else:
            print('No')
        return
    if l == 2:
        if cnt[1][0] == 0 and cnt[1][1] == n:
            print('Yes')
        else:
            print('No')
        return
    if l > 3 or N % 3:
        print('No')
        return

    if cnt[0][0] ^ cnt[1][0] == cnt[2][0] and cnt[0][1] == cnt[1][1] == n:
        print('Yes')
    else:
        print('No')

input = lambda: stdin.readline()
main()


Measured memory_bytes: 15632
#include<stdio.h>

typedef struct Card{
  char suit;
  int value;
  int id;
}card;

void bubblesort(card c[],int n);
void selectionsort(card c[],int n);
void sorns(card c[],int n);

int main(){
  int N,i;
  
  scanf("%d",&N);
  card c1[N];
  card c2[N];
  
  for(i=0;i<N;i++){
    scanf(" %c%d",&c1[i].suit,&c1[i].value);
    c1[i].id=i;
    c2[i]=c1[i];
  }
  
  bubblesort(c1,N);
  selectionsort(c2,N);
  
  for(i=0;i<N;i++){
    printf("%c%d",c1[i].suit,c1[i].value);
    if(i<N-1) printf(" ");
  }
  
  printf("\n");
  sorns(c1,N);
  for(i=0;i<N;i++){
    printf("%c%d",c2[i].suit,c2[i].value);
    if(i<N-1){
      printf(" ");
    }
  }
  printf("\n");
  sorns(c2,N);
  return 0;
}

void bubblesort(card c[],int n){
  int i,j;
  card temp;
  for(i=0;i<=n-1;i++){
    for(j=n-1;j>=i+1;j--){
      if(c[j].value<c[j-1].value){
    temp = c[j];
    c[j] = c[j-1];
    c[j-1] = temp;
      }
    }
  }
}

void selectionsort(card c[],int n){
  int i,j,minj;
  card temp;
  for(i = 0;i<=n-1;i++){
    minj = i;
    for(j = i;j<=n-1;j++){
      if(c[j].value < c[minj].value){
    minj = j;
      }
    }
    temp = c[i];
    c[i] = c[minj];
    c[minj] = temp;
  }
}

void sorns(card c[],int n){
  int stable=1,i;
  for(i=1;i<n;i++){
    if(c[i-1].value == c[i].value && c[i-1].id > c[i].id) stable=0;
  }
  if(stable==1) printf("Stable\n");
  else printf("Not stable\n");
}



Measured memory_bytes: 2028
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1

//{
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define ins insert
#define aer(v) (v).erase((v).begin(),(v).end()) 
#define fh(x,v) for(auto x:v)

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int a[5],k,ans;

main(){
	rep(i,5)cin>>a[i];
	int l=a[0],itr=0;
	rep(i,5){
		if((l-1)%10>(a[i]-1)%10){
			l=a[i];
			itr=i;
		}
	}
	rep(i,5){
		if(i==itr)continue;
		ans+=a[i];
		while(ans%10!=0)ans++;
	}
	ans+=l;
	dans;
}






Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N, T[100], M, P, X, tot = 0, i, result[100];
  
  scanf("%d", &N);
  for (i = 0; i < N; i++){
    scanf("%d",&T[i]);
    tot += T[i];
  }
  scanf("%d", &M);
  for (i = 0; i < M; i++){
    scanf("%d %d", &P, &X);
    result[i] = tot - T[P - 1] + X;
  }
  
  for (i = 0; i < M; i++){
    printf("%d\n", result[i]);
  }
  
  return 0;
}

Measured memory_bytes: 128
from functools import reduce

def operator(x, K, N):
    res = (lambda x: 2*x if x < K else x+K)(x)
    return res if N == 1 else operator(res, K, N-1)

def main():
    with open(0) as f:
        N, K = map(int, f.read().split())
    ans = operator(1, K, N)
    print(ans)

main()    


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

int main(){
	int n; cin >> n;
	string s;
	cin >> s;
	int ans=0;
	for(int i=0;i<n-1;i++){
		int temp=0;
		vector<char> c;
		int j;
		for(j=0;j<=i;j++){
			bool doub=false;
			for(int k=0;k<c.size();k++){
				if(s[j]==c[k]){
						doub=true;
				}
			}
			if(!doub) c.push_back(s[j]);
		}
		for(j;j<n;j++){
			for(int k=0;k<c.size();k++){
				if(s[j]==c[k]){
					temp++;
					c.erase(c.begin()+k);
					break;
				}
			}
		}
		ans=max(ans,temp);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
n,l=int(input()),list(map(int,input().split()))
c1,c2=0,abs(l[0]-l[1])
for i in range(2,n):
  t=c2
  c2=min(c1+abs(l[i]-l[i-2]),c2+abs(l[i]-l[i-1]))
  c1=t
print(c2)

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

int main() {
  int n;
  ll t = 0;
  cin >> n;
  vector<P>d(n);
  rep(i,n) cin >> d[i].second >> d[i].first;
  sort(d.begin(),d.end());
  rep(i,n){
    t += d[i].second;
    if(t > d[i].first){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 3328
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=100100;
int i,j,k,n,m,ch,ff,En,ans;
int a[N],f[N],h[N];
struct edge { int s,n;} E[N];
void R(int &x) {
	ff=x=0;ch=getchar();
	while (ch<'0' || '9'<ch) { if (ch='-') ff=1;ch=getchar();}
	while ('0'<=ch && ch<='9') x=x*10+ch-'0',ch=getchar();
	if (ff) x=-x;
}
void E_add(int x,int y) {
	E[++En].s=y;E[En].n=h[x];h[x]=En;
}
void dfs(int x) {
	f[x]=1;
	for (int k=h[x];k;k=E[k].n) {
		dfs(E[k].s);
		f[x]=max(f[x],f[E[k].s]+1);
	}
	if (a[x]!=1 && f[x]==m) f[x]=0,ans++;
}
int main() {
	R(n);R(m);
	for (i=1;i<=n;i++) R(a[i]);
	for (i=2;i<=n;i++) E_add(a[i],i);
	if (a[1]!=1) ans++;
	a[1]=1;
	dfs(1);
	printf("%d\n",ans);
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define ll long long
const ll INF = 1e9;
int main(){
    int n,m,x; cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int> > a(n,vector<int>(m));
    rep(i,n){
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }
    bool ok = false;
   
    ll ans = INF;
    for(int bit=0;bit<(1<<n);++bit){
        ll coin=0;
        vector<ll> res(m,0);
        rep(i,n){
            if(bit & (1<<i)){
                coin += c[i];
                rep(j,m) res[j] += a[i][j];
            }
        }
        bool yes=true;
        rep(i,m){
            if(res[i]<x){
                yes = false;
                break;
            }
        }
        if(yes){
            ans = min(ans,coin);
            ok = true;
        }
        rep(i,m) res[i] = 0;
    }
    if(ok) cout << ans << endl;
    else cout << -1 << endl;
    
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX=1e5+10;
int pos[30];
int Nxt[MAX][30];
void pr(ll res){
    cout<<res<<"\n";
    exit(0);
}
bool isseq(string S,string T)
{
    int F[26],G[26];
    memset(F,0,sizeof F);
    memset(G,0,sizeof G);
    for(int i=0;i<S.size();i++){
        F[S[i]-'a']++;
    }
    for(int i=0;i<T.size();i++){
        G[T[i]-'a']++;
    }
    for(int i=0;i<26;i++){
        if(!F[i]&&G[i])return 0;
    }
    return 1;
}
int main ()
{
    string S,T;cin >> S >> T;
    if(isseq(S,T)==0){
        pr(-1);
    }
    int sz = S.size();
    for(int i=0;i<26;i++)pos[i]=sz+1;
    for(int i=sz;i>=0;i--){
        for(int j=0;j<26;j++)Nxt[i][j]=pos[j];
        if(i)pos[S[i-1]-'a']=i;
    }
    ll res = 0,curr=0,prev=0;
    for(int i=0;i<T.size();i++){
            curr = Nxt[prev][T[i]-'a'];
            if(curr>sz){res+=sz;curr = Nxt[0][T[i]-'a'];}
            if(curr>sz){pr(-1);}
            prev = curr;
    }
    pr(res+prev);
    return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

bool judge(std::string s){
    if(s.size()%2!=0)return false;

    //cout<<"s="<<s<<endl;
    string t = s.substr(0,s.size()/2);
    //cout<<"t="<<t<<endl;
    if(s==(t+t))return true;
    else return false;
}

void func(std::string S){
    REP(i,1,S.size()){
        if(judge(S.substr(0,S.size()-i))){
            cout<<S.size()-i<<endl;
            return;
        }
    }
}

int main(){
    // cout << fixed << setprecision(5);

    std::string S;
    std::cin >> S;
    func(S);
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma warning(disable:4996)
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int, P>PP;
int a[100006];
int gcd(int a, int b){
	if (!b)return a; return gcd(b, a%b);
}

signed main() {
	int n; cin >> n;
	rep(i, n)cin >> a[i];
	int ans = a[0];
	rep(i, n)ans = gcd(ans, a[i]);
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<bits/stdc++.h>
#define logo(cnt) std::cout<<cnt<<std::endl;
using namespace std;
typedef long long ll;

int main()
{
    int num,height_test_case,cnt=0;
    cin>>num>>height_test_case;
    vector<int>V;
    while(num--)
    {
        ll n;
        cin>>n;
        V.push_back(n);
    }
    for(int i=0;i<V.size();i++)
        if(V[i]>=height_test_case)
            cnt++;
    logo(cnt);
    V.clear();
    std::cin.get();
}


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

int main(){
	string s;
	cin >> s;
	if(s.find('a') != string::npos && s.find('b') != string::npos && s.find('c') != string::npos)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int m, f, r;
    int sum;
    while (1){
        scanf("%d %d %d", &m, &f, &r);
        if (m == -1 && f == -1 && r == -1){
            break;
        }

        sum = m + f;
        if (m != -1 && f != -1){
            if (50 <= r){ puts("C"); }
            else{
                if (sum < 30) puts("F");
                if (30 <= sum && sum < 50) puts("D");
                if (50 <= sum && sum < 65) puts("C");
                if (65 <= sum && sum < 80) puts("B");
                if (80 <= sum) puts("A");
            }
        }
        else { puts("F"); }
    }
    return 0;
}

Measured memory_bytes: 584
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

MOD = int(1e09) + 7

def main():
    N = cin.int()
    H = cin.mapInt()
    for i in reversed(range(N - 1)):
        d = H[i] - H[i + 1]
        if d <= 0:
            continue
        if d == 1:
            H[i] -=1
        else:
            print("No")
            return
    print("Yes")
    return

if __name__ == "__main__":
    main()


Measured memory_bytes: 64240
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;



int main() {
    vector<vector<int>> to;
    vector<int> done;
    vector<int> cut;
    int bridge =0;

    int N, M;
    cin >> N >> M;

    to = vector<vector<int>>(N+1,vector<int>(N+1,0));
    cut = vector<int>(N+1,0);
    done = vector<int>(N+1,0);
    for(int i=1; i<=M; i++){
        int a,b;
        cin >> a >> b;
        to[a][b] =1;
        to[b][a] =1;
    }

    int target=1;
    while(true){
        // clear check
        int all =0;
        for(int i=1; i<=N; i++){
            all+=done[i];
        }
        if(all ==N){
            break;
        }

        // search
        int to_count=0;
        for(int i=1; i<=N; i++){
            if (to[target][i] == 1){
                to_count++;
            }
            if(to_count >= 2 || to_count == 0){
                done[target]=1;
            }
        }

        if(to_count ==1){
            for(int i = 1; i<=N; i++){
                if(to[target][i]==1){
                    to[target][i]=0;
                    to[i][target]=0;
                    done[target]=1;
                    done[i] =0;
                    bridge++;
                    target = i;
                    break;
                }
            }
        }else{
            for(int i=1; i<=N; i++){
                if(done[i]==0){
                    target = i;
                }
            }
        }
    }

    cout << bridge << endl;
    return 0;
}

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

signed main() {
	int h, w, n, sr, sc;
	string s, t;
	cin >> h >> w >> n >> sr >> sc >> s >> t;

	int right_max = sc, down_max = sr, right_min = sc, down_min = sr;

	char e;
	for (int i = 0; i < n; ++i) {
		e = s[i];
		if (e == 'R') right_max++;
		else if (e == 'L') right_min--;
		else if (e == 'U') down_min--;
		else if (e == 'D') down_max++;

		if (down_max > h or down_min <= 0 or right_max > w or right_min <= 0) {
			cout << "NO" << endl;
			return 0;
		}

		e = t[i];
		if (e == 'R' and right_min < w) right_min++;
		else if (e == 'L' and right_max > 1) right_max--;
		else if (e == 'U' and down_max > 1) down_max--;
		else if (e == 'D' and down_min < h) down_min++;
	}

	cout << "YES" << endl;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define double long double
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100000000;
typedef pair<int,int> P;

vector<int>a;

int main(void){
    int ans=INF;
    int d,g;
    cin>>d>>g;
    vector<int>p(d);
    vector<int>c(d);
    rep(i,d) cin>>p[i]>>c[i];
    for(int bit=0;bit<(1<<d);++bit){
        int sum=0;
        int last=-1;
        int count=0;
        for(int i=0;i<d;i++){
            if(bit&(1<<i)){
            sum+=(i+1)*100*p[i];
            sum+=c[i];
            count+=p[i];
            }else{
                last=i;
            }
        }
        if(sum<g){
            int s=100*(last+1);
            int need=(g-sum+s-1)/s;
            if(need>=p[last]){
                continue;
            }
            count+=need;
        }
        ans=min(ans,count);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#define _overload(_1, _2, _3, _4, name, ...) name
#define _rep1(Itr, N) _rep3(Itr, 0, N, 1)
#define _rep2(Itr, a, b) _rep3(Itr, a, b, 1)
#define _rep3(Itr, a, b, step) for (i64 (Itr) = a; (Itr) < b; (Itr) += step)
#define repeat(...) _overload(__VA_ARGS__, _rep3, _rep2, _rep1)(__VA_ARGS__)

#include "bits/stdc++.h"
using i64 = long long;
using namespace std;

//===
// nCr mod p
// p is prime
// 1 <= k <= n <= 1e7

void init_comb(long long modulus);
void init_comb(void);
long long combination(long long n, long long k);
long long pow_mod(long long n, long long m);

long long _modulus = (long long)1e9 + 7;
long long fact[1000007];
long long fact_inv[1000007];

void init_comb(long long modulus) {_modulus = modulus; }
void init_comb(void) {
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    for (int i = 2; i <= 1000000; i++) {
        fact[i] = fact[i - 1] * i % _modulus;
        fact_inv[i] = pow_mod(fact[i], _modulus - 2);
    }
}

long long combination(long long n, long long k) {
    static long long f;

    if (f != _modulus) f = _modulus, init_comb();

    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;

    return fact[n] * (fact_inv[k] * fact_inv[n - k] % _modulus) % _modulus;
}

long long pow_mod(long long n, long long m) {
    //n ** m;
    long long ret = 1;

    while (m) {
        if (m & 1) {
            ret = ret * n % _modulus;
        }

        n = n * n % _modulus;
        m = m >> 1;
    }

    return ret;
}
//===

int main() {
    i64 mod = i64(1e9) + 7;
    i64 s;
    cin >> s;

    i64 ans = 0;
    for (i64 i = 1; i <= s; i++) {
        i64 a = s - 3*i;
        ans += combination(a + i - 1, a);
        ans %= mod;
    }

    cout << ans << endl;

    return 0;
};


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

int main(void){
    long long int a,b,s;
    scanf("%lld %lld",&a,&b);
    s=a-b;
    if(s%2==0){
      	s=s/2;
        s=abs(s);
      	if(a>b){
          s=s+b;
        }else{
        	s=s+a;
        }
        printf("%lld",s);
    }else{
        printf("IMPOSSIBLE");
    }
    return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#pragma region include

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////

void solve() {
	int N;
	cin >> N;
	vector<int> A(N);
	vector<LL> B(N + 1, 0);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		B[A[i]] ++;
	}
	///////////
	vector<LL> C(N + 1, 0);
	vector<LL> D(N + 1, 0);
	LL sum = 0;
	for (int i = 1; i <= N; ++i) {
		LL ter = B[i];
		C[i] = ter * (ter - 1) / 2;

		sum += C[i];

		--ter;
		D[i] = ter * (ter - 1) / 2;
	}
	for (int i = 0; i < N; ++i) {
		cout << sum - C[A[i]] + D[A[i]] << endl;
	}
	
}

#pragma region main
signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 8064
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
	long int a,b;
	cin>>a>>b;
	if(a>12)
	{
	    cout<<b;
	}
	else if(a>=6 && a<=12)
	{
	    cout<<b/2;
	}
	else
	{
	    cout<<"0";
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int b[n];
  for(int i = 0; i < n-1; i++) cin >> b[i];
  long long ans = b[0];
  for(int i = 0; i < n-2; i++){
    ans += min(b[i], b[i+1]);
  }
  ans += b[n-2];
  cout << ans << endl;
  return 0;
}

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

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)

using namespace std;

template <typename T>
void show_all(T t) {
  rep (i, t.size()) {
    rep (j, t[0].size()) {
      cout << t[i][j];
    }
    cout << endl;
  }
}

int main() {
  int e;
  while (1) {
    cin >> e;
    if (!e) break;

    // greedy(O(3*N)?): WA
    // int i;
    // int x, y, z;
    // for (i=0; pow(i, 3) <= e; i++) {}
    // z = i-1;
    // e -= pow(z, 3);
    //
    // for (i=0; pow(i, 2) <= e; i++) {}
    // y = i-1;
    // e -= pow(y, 2);
    //
    // x = e;
    // cout << x+y+z << endl;
    //

    // O(N^2): TLE
    // int ans = 10000000 + 7;
    // for (int z=0; pow(z,3)<=e; z++) {
    //   for (int y=0; pow(z,3)+pow(y,2)<=e; y++) {
    //     int x = e - (pow(z,3)+pow(y,2));
    //     if (x + pow(y,2) + pow(z,3) != e) continue;
    //     ans = min(ans, x+y+z);
    //   }
    // }

    int ans = 10000000 + 7;
    for (int z=0; pow(z,3)<=e; z++) {
      int y = sqrt(e-pow(z,3));
      int x = e-pow(z,3)-pow(y,2);
      if (x + pow(y,2) + pow(z,3) != e) continue;
      ans = min(ans, x+y+z);
    }

    cout << ans << endl;
  }
}

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

int main() {
  int n,m;
  cin >> n >> m;
  priority_queue<ll> q;
  rep(i,0,n) {
    ll a;
    cin >> a;
    q.push(a);
  }
  rep(i,0,m) {
    ll a = q.top(); q.pop();
    a /= 2;
    q.push(a);
  }
  ll ans = 0;
  rep(i,0,n) {
    ans += q.top(); q.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4224