akhauriyash/Code-Regression huggingface dataset:
// ref. https://www.youtube.com/watch?v=pKOPnK1JPLE

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n, d, a;
  cin >> n >> d >> a;
  vector<P> p(n);
  rep(i, n) {
    cin >> p[i].first >> p[i].second;
  }
  sort(all(p));

  ll ans = 0;
  ll tot = 0; // total damge at current position
  queue<P> q;
  rep(i, n) {
    ll x = p[i].first;
    ll h = p[i].second;

    // Decrease the damage which is in the out of range.
    while (!q.empty() && q.front().first < x) {
      tot -= q.front().second;
      q.pop();
    }

    h -= tot;
    if (h > 0) { // remaining
      ll num = (h+a-1)/a; // the round up of h/a
      ans += num;
      ll damage = num*a;
      tot += damage;
      q.emplace(x+d*2, damage); // add damage which is effectve in [x, x+d*2]
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 4992
package main

import (
        "fmt"
        "strconv"
)

func solution(a int, b string) int {
        x := make([]byte, 0, len(b))
        for i := range b {
                if b[i] != '.' {
                        x = append(x, b[i])
                }
        }
        bn, _ := strconv.Atoi(string(x))

        return a * bn / 100
}

func main() {
        var a int
        var b string
        fmt.Scan(&a, &b)
        fmt.Println(solution(a, b))
}


Measured memory_bytes: 1756
#include <stdio.h>

int main(void) {
	int a, b, c, d=0;
	
	scanf("%d %d %d", &a, &b, &c);
	
	if(a==5 && b==5 && c==7){
	printf("YES\n");
	d++;}
	if(a==5 && b==7 && c==5){
	printf("YES\n");
	d++;}
	if(a==7 && b==5 && c==5){
	printf("YES\n");
	d++;}
	if(d==0)
	printf("NO\n");
	return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=998244353;
//const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
struct mint{
    using ull=unsigned long long int;
    ull v;
    mint(ll vv=0){s(vv%mod+mod);}
    mint& s(ull vv){
        v=vv<mod?vv:vv-mod;
        return *this;
    }
    //オーバーロード
    mint operator-()const{return mint()-*this;}//mint型にキャスト
    mint&operator+=(const mint&val){return s(v+val.v);}
    mint&operator-=(const mint&val){return s(v+mod-val.v);}
    mint&operator*=(const mint&val){
        v=ull(v)*val.v%mod;
        return *this;
    }
    mint&operator/=(const mint&val){return *this*=val.inv();}
    mint operator+(const mint&val){return mint(*this)+=val;}
    mint operator-(const mint&val){return mint(*this)-=val;}
    mint operator*(const mint&val){return mint(*this)*=val;}
    mint operator/(const mint&val){return mint(*this)/=val;}
    mint pow(ll n)const{
        mint res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1ll;
        }
        return res;
    }
    mint inv()const{return pow(mod-2);}
    //拡張ユークリッドの互除法
    /* mint inv()const{
        int x,y;
        int g=extgcd(v,mod,x,y);
        assert(g==1);
        if(x<0)x+=mod;
        return mint(x);
    }*/
    friend ostream& operator<<(ostream&os,const mint&val){
        return os<<val.v;
    }//出力
    bool operator<(const mint&val)const{return v<val.v;}
    bool operator==(const mint&val)const{return v==val.v;}
    bool operator>(const mint&val)const{return v>val.v;}
};
const ll MAX = 2000010;//設定
mint fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void init(){
    fac[0] = fac[1] = 1;
    for(int i=1;i<MAX;i++)fac[i]=fac[i-1]*i;
    finv[MAX-1]=fac[MAX-1].inv();
    for(int i=MAX-2;i>=0;i--)finv[i]=finv[i+1]*(i+1);
    for(int i=MAX-2;i>=1;i--)inv[i]=finv[i]+fac[i-1];
}
//階乗
mint factor(ll n,ll k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n]*finv[k];
}
// 二項係数計算
mint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[k] * finv[n - k];
}
int main(){
    ll n,a,b,k;
    cin>>n>>a>>b>>k;
    mint ans=0;
    init();
 for(ll i=0;i<=n;i++){
     ll d=a*i;
     if(k-d<0)break;
     if((k-d)%b!=0)continue;
	 if((k-d)/b>n)continue;
     ans+=COM(n,i)*COM(n,(k-d)/b);
 }
 cout<<ans<<"\n";
}


Measured memory_bytes: 50524
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 
 using namespace std;
 
 int main()
 {
   string s;
   while(cin>>s)
   {
     string result="";
     for(int i=0;i<s.length();i++)
     {
       if(s[i]=='@')
       {
         int num=(s[i+1]-'0');
         char kk=s[i+2];
         while(num--) result+=kk;
         i=i+2;               
       }        
       else result+=s[i];
     }     
     cout<<result<<endl;       
   }
   //while(1);
   return 0; 
 }

Measured memory_bytes: 3168
#include <iostream>
#include <vector>
#include <algorithm>
#include <complex>
#include <climits>

using namespace std;

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

   cin >> a >> b;

   int h = b - a;
   cnt++;

    if (b == 1) {
        cnt = 0;
    }

   while (h > 0) {

       h -= a - 1;
       cnt++;
   }

   cout << cnt;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int a, b, c;
	cin >> a >> b >> c;
	printf("%d\n", a != c);
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){
	throw;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

using pll = pair<ll, ll>;
pll func(int N, vector<int> A, vector<int> B, int type = 0) {
	vector<int> cx;
	REP(i, N) {
		cx.emplace_back(A[i]);
		cx.emplace_back(B[i]);
	}
	cx.push_back(-INF);
	cx.push_back(INF);
	sort(ALL(cx));
	cx.erase(unique(ALL(cx)), cx.end());
	
	vector<int> ls(cx.size()), rs(cx.size());
	if (type == 0) {
		REP(i, N) {
			++ls[lower_bound(ALL(cx), A[i]) - cx.begin()];
			++rs[lower_bound(ALL(cx), B[i]) - cx.begin()];
		}
		ls[0] = 0;
		REP(i, cx.size() - 1) ls[i + 1] += ls[i];
		rs[0] = 0;
		REP(i, cx.size() - 1) rs[i + 1] += rs[i];
		
		int fis = -INF;
		ll ans = 0;
		REP(i, cx.size() - 1) {
			int firc = rs[i]; // 左にいる数
			int frec = ls[i] - rs[i]; // 自由な数
			if (firc > (N - 1) / 2) break;

			if (firc + frec >= (N + 1) / 2) {
				if (fis == -INF) fis = cx[i];
				ans += cx[i + 1] - cx[i];
			}
		}
		return pll(fis, fis + ans - 1);
	}
	else {
		REP(i, N) {
			++ls[lower_bound(ALL(cx), A[i]) - cx.begin()];
			++rs[lower_bound(ALL(cx), B[i]) - cx.begin()];
		}
		ls[cx.size() - 1] = 0;
		for (int i = cx.size() - 1; i > 0; --i) ls[i - 1] += ls[i];
		
		rs[cx.size() - 1] = 0;
		for (int i = cx.size() - 1; i > 0; --i) rs[i - 1] += rs[i];
		
		int fis = -INF;
		ll ans = 0;
		for (int i = cx.size() - 1; i > 0; --i) {
			int firc = ls[i]; // 右にいる数
			int frec = rs[i] - ls[i]; // 自由な数
			if (firc > (N - 1) / 2) break;
			if (firc + frec >= (N + 1) / 2) {
				if (fis == -INF) fis = cx[i];
				ans += cx[i] - cx[i - 1];
			}
		}
		return pll(fis - ans + 1, fis);
	}
	

}

int main() {
	int N;
	cin >> N;
	vector<int> A(N), B(N);
	REP(i, N) {
		scanf("%d %d", &A[i], &B[i]);
	}
	

	

	// rs[cx.size() + 1] = 0;
	// for (int i = cx.size(); i > 0; --i) rs[i - 1] += rs[i];
	
	
	if (N % 2 == 1) {
		REP(i, N) B[i]++;
		pll ans = func(N, A, B);
		cout << ans.se - ans.fi + 1 << endl;
	}
	else {
		vector<int> cA = A, cB = B;
		REP(i, N) cB[i]++;
		pll ans1 = func(N, cA, cB);
		
		REP(i, N) A[i]--;
		pll ans2 = func(N, A, B, 1);
		
		ll ans = ans1.se + ans2.se - ans2.fi - ans1.fi + 1;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 13244
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
#define inf 1000000000000000000
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(x) (x).begin(),(x).end()
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; }

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

  ll n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  map<tuple<ll, ll, ll>, ll> dp;
  dp[{0, 0, 0}] = 0;

  for (ll i = 1; i < n + 1; i++) {
    ll maxj = (i % 2 == 0)? i/2 : i/2 + 1;
    ll minj = ((n - i) % 2 == 0)? n/2 - (n - i)/2 : n/2 - ((n - i)/2 + 1);
    for (ll j = minj; j < maxj + 1; j++) {
      if (dp.count({i - 1, j, 0}) == 0) dp[{i - 1, j, 0}] = -inf;
      if (dp.count({i - 1, j, 1}) == 0) dp[{i - 1, j, 1}] = -inf;
      if (dp.count({i - 1, j - 1, 0}) == 0) dp[{i - 1, j - 1, 0}] = -inf;
      dp[{i, j, 0}] = max(dp[{i - 1, j, 0}], dp[{i - 1, j, 1}]);
      dp[{i, j, 1}] = dp[{i - 1, j - 1, 0}] + a[i - 1];
    }
  }
  cout << max(dp[{n, n/2, 0}], dp[{n, n/2, 1}]) << endl;
}


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

int main() {
  int n, ans = 0;
  string s, t;
  cin >> s >> t;
  vector<int> v(n + 10);
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != t[i]) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3908
import sys

if sys.platform =='ios':
	sys.stdin=open('input_file.txt')
	
n=int(input())
l=list(map(int,input().split()))
lsort=sorted(l)
cnt=0

for i in range(n):
	if l[i]==lsort[i]:
		cnt+=1
		
if cnt==n or cnt==n-2:
	print("YES")
	
else:
	print("NO")


Measured memory_bytes: 3060
N,K = map(int,input().split())

a = []
a.append(N)

if N % K == 0:
    print(0)
else:
    N = N % K
    while True:
        if abs(N - K) not in a:
            a.append(abs(N - K))
            N = abs(N - K)
        else:
            print(min(a))
            break

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

#define clr(i, j)     memset(i, j, sizeof(i))
#define pb            push_back
#define mp            make_pair
typedef long long     ll;
bool kk=true;
//map<int,int>r;int arr[100000];
bool rr[3];
int main()

{
   /*
int n,m,k;   cin>>n>>m>>k;

for(int r=0;r<n;r++){

       cin>>a[r];

}
for(int r=0;r<n;r++){
for(int dd=0;dd<n;dd++){


       }

}*/
int n;
cin>>n;int ans=0;
for(int i=0;i<n;i++){
    int o;cin>>o;int l=0;
    if(o%2==0){
        while(o%2==0){
            o/=2;
            l++;
        }
       ans+=l;
    }
}
cout<<ans;
}


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

string str;
int t,ans;
bool f;
vector<int> ansv;

void solve(int n, int pos, vector<int> v){
  int a = 0;
  for(int i=pos;i<str.size();i++){
    vector<int> v2 = v;
    a *= 10;
    a += str[i] - '0';
    v2.push_back(a);
    if(n + a > t) return;
    if(i != str.size() - 1) solve(n+a, i+1, v2);
  }
  v.push_back(a);
  if(n + a > ans){
    ans = n + a;
    ansv = v;
    f = false;
  } else if(n + a == ans) f = true;
}

int main(){
  while(cin >> t >> str){
    if(t == 0 && str == "0") break;
    f = false;
    ans = -1;
    ansv.clear();
    solve(0,0,vector<int>(0,0));
    if(ans == -1) cout << "error" << endl;
    else if(f) cout << "rejected" << endl;
    else {
      cout << ans;
      for(int i=0;i<ansv.size();i++) cout << ' ' << ansv[i];
      cout << endl;
    }
  }
}

Measured memory_bytes: 1228
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static int min(a, b)
{
    return a < b ? a : b;
}

int main(int argc, char **argv)
{
    int n;
    scanf("%d", &n);
    int h[n];
    int c[n];
    c[0] = c[1] = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", h + i);
        if (i == 0) continue;
        if (i == 1) {
            c[i] = c[i - 1] + abs(h[i - 1] - h[i]);
        } else {
            c[i] = min(c[i - 1] + abs(h[i - 1] - h[i]), c[i - 2] + abs(h[i - 2] - h[i]));
        }
    }
    printf("%d\n", c[n - 1]);
    return EXIT_SUCCESS;
}


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

using namespace std;

const int N = 2e5 + 7 ; 
int n; 
int a[N] ; 
int occ[N];
long long ans ;

int main(){
  //  freopen("in.in" , "r" , stdin); 
    cin>>n  ; 
    for(int i = 0 ; i < n; i++){
        cin>> a[i]; 
        ans +=occ[ a[i] ]++;
    }
    for(int i = 0  ; i <n ;i++){
        ans-=--occ[ a[i] ];
        cout<<ans<<"\n" ; 
        ans+=occ[ a[i] ]++;
    }
    return 0 ;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
typedef long double lb;
using namespace std;
ll gcd(ll P, ll Q){
  return Q ? gcd(Q,P % Q):P;
}
ll lcm(ll P, ll Q){
  return P / gcd(P,Q) * Q;
}
int main(){
  ll P,Q;
  while(cin >> P >> Q){
    cout << gcd(P,Q) << " " <<  lcm(P,Q) << endl;
  }
}


Measured memory_bytes: 3032
#include <bits/stdc++.h>
    using namespace std;
    #define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
    #define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
    #define ll long long int
    #define FF first
    #define SS second
    #define mp make_pair
    #define pb push_back
    #define pii pair<int,int>
    #define pll pair<long long int,long long int>
    #define sd(x) scanf("%d",&x)
    #define slld(x) scanf("%lld",&x)
    #define pd(x) printf("%d\n",x)
    #define plld(x) printf("%lld\n",x)
    #define pss printf
    #define MOD 1000000007
    #define INF 1e18
    #define eps 0.00001
    #define endl '\n'
    #define debug(n1) cout<<n1<<endl
    const int N = 1e5;  // limit for array size
    ll n;  // array size
     
    /*template<typename T>
    using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
     
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int rand(int l, int r){
        uniform_int_distribution<int> uid(l, r);
        return uid(rng);
    }
    */
    int main(){
        int k,x;cin>>k>>x;
        for(int i=x-k+1;i<=x+k-1;i++){
        	cout<<i<<" ";
		}
    	return 0;
    }

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

int partition(int* A, int p, int r) {
    int x = A[r];
    int i = p - 1;
    for(int j = p; j < r; ++j) {
        if(A[j] <= x) {
            ++i;
            int cpy = A[i];
            A[i] = A[j];
            A[j] = cpy;
        }
    }
    int cpy = A[r];
    A[r] = A[i + 1];
    A[i + 1] = cpy;
    
    return i + 1;
}

int main(void) {
    int A[100000];
    int n;
    
    cin >> n;
    
    for(int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    
    int t = partition(A, 0, n - 1);
    
    for(int i = 0; i < t; ++i) {
        cout << A[i] << ' ';
    }
    cout << "[" << A[t] << "]";
    for(int i = t + 1; i < n; ++i) {
        cout << ' ' << A[i];
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 3396
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    long long int attack = 0;
    int Hi[N];
    for(int i = 0; i < N; i++){
        cin >> Hi[i];
    }

    sort(Hi, Hi + N);

    int i = N-1 - K;
    
    while(i >= 0){
        attack += Hi[i];
        i--;
    }
    cout << attack << '\n';
}

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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	LL x, y;
	cin >> x >> y;
	if (abs(x - y) <= 1) cout << "Brown\n";
	else cout << "Alice\n";
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#define MM 4000000
#define MN 2005
using namespace std;
inline int in(){
    int x=0;bool f=0; char c;
    for (;(c=getchar())<'0'||c>'9';f=c=='-');
    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');
    return f?-x:x;
}
bitset <MM+5> b;
int a[MN],n,sum,tot;
int main()
{
	n=in();b[0]=1;
	for (int i=1;i<=n;++i) a[i]=in(),sum+=a[i];tot=sum>>1;
	for (int i=1;i<=n;++i) b|=(b<<a[i]); 
	for (int i=tot;i>=0;--i) if (b[i]) {printf("%d",sum-i);return 0;}
}

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

int bitcount(int x) {
	if (x == 0) return 0;
	return bitcount(x >> 1) + (x & 1);
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	int x[15][15], y[15][15];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		for (int j = 0; j < a[i]; j++) {
			cin >> x[i][j] >> y[i][j];
			x[i][j]--;
		}
	}

	int ans = 0;
	for (int bit = 0; bit < (1 << n); bit++) {
		bool ok = true;
		for (int i = 0; i < n; i++) {
			if (!(bit & (1 << i)))
				continue;
			for (int j = 0; j < a[i]; j++)
				if (((bit >> (x[i][j])) & 1) != y[i][j])
					ok = false;
		}
		if (ok)
			ans = max(ans, bitcount(bit));
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
	int n, m, x;
	cin >> n >> m >> x;
	vector<vector<int>> a(n, vector<int>(m + 1));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m + 1; j++) cin >> a[i][j];
	}

	int ans = INT_MAX;
	for (int bit = 0; bit < (2 << n); bit++) {
		vector<int> algorithm(m);
		int money = 0;
		for (int i = 0; i < n; i++) {
			if (bit & (1 << i)) {
				money += a[i][0];
				for (int j = 1; j <= m; j++) algorithm[j - 1] += a[i][j];
			}
		}
		int flag = true;
		for (const auto& item : algorithm) {
			if (item < x) {
				flag = false;
				break;
			}
		}
		if (flag) ans = min(ans, money);
	}

	if (ans == INT_MAX) cout << -1 << endl;
	else cout << ans << endl;
}


Measured memory_bytes: 3588
// Problem : A - Kth Term
// Contest : Panasonic Programming Contest 2020
// URL : https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

/*
 * author :Sadik Hassan
 * 
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)      for(int i=0;i<n;i++)
#define repn(i,n)     for(int i=1;i<=n;i++)
#define rrep(i,n)     for(int i=n-1;i>=0;i--)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
#define TSFL(s)       transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSFH(s)       transform(s.begin(),s.end(),s.begin(),::tolower);
/*---------------------------------------------------------------------*/
const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
	int n;
	cin>>n;
	int a[32]={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};
	cout<<a[n-1]<<nl;
    return 0;
}


Measured memory_bytes: 256
/*
 
 * This code is written by Sanskar Agarwal
 
*/
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define VPLL vector<PLL>
#define VPII vector<PII>
#define PQ priority_queue<PLL,VPLL, greater<PLL> > 
#define PQI priority_queue<PII,VPII,greater<PII> >
#define UMLL unordered_map<ll,ll>
#define UMII unordered_map<int,int>
#define VI vector<int>
#define VL vector<ll>
#define S second
#define F first
#define PB push_back


int main()
{


    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    
    double n,d;
    cin>>n>>d;
    ll cnt=0;
    for(ll i=0;i<n;i++)
    {
        double x,y;
        cin>>x>>y;
        double sum=sqrt(x*x+y*y);
        if(sum<=d)
            cnt++;
    }
    cout << cnt;

    return 0;
}

Measured memory_bytes: 3860
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
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(a > b){a = b; return 1;} return 0;}


int main(int argc, char const* argv[])
{
  int n, a, b;
  cin >> n >> a >> b;
  int res = 0;
  if(a + b <= n)res = 0;
  else res = a + b - n;
  cout << min(a, b) << " " << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}



///////////////////////////

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


ll p(ll n) {
	if (n == 0) { return 1; }
	else {return 4 * p(n - 1)%MOD; }
}

int main() {

	ll N;
	cin >> N;

	vector<ll> C(N + 1);

	repn(i, N)cin >> C[i];

	sort(++C.begin(), C.end());

	ll ans = 0;

	ll K = p(N - 1);

	repn(i, N) {
		ll x =K*(N - i + 2) % MOD;
		x = x * C[i] % MOD;
		ans = (ans + x) % MOD;
	}
	
	cout << ans;

	system("PAUSE");

}


Measured memory_bytes: 5120
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
G1=[]
G2=[]
for i in range(N):
  t=A[i]-B[i]
  if t>=0:
    G1.append(t)
  else:
    G2.append(t)
G1.sort(reverse=True)    
k=len(G2)

if k==0:
  print(0)
else:
  s=sum(G2)
  for i in range(len(G1)):
    s+=G1[i]
    if s>=0:
      print(k+i+1)
      break
  else:
    print(-1)

Measured memory_bytes: 19068
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        a1: usize, a2: usize, a3: usize
    };

    let res = if a1 + a2 + a3 >= 22 { "bust" } else { "win" };
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2276
object Main{
  def main(args: Array[String]){
    val input=io.Source.stdin.getLines().mkString("\n")
    println(solve(input).trim())
  }

  def solve(input:String):String={
    val Array(n,k)=input.split("\n")(0).split(" ").map(_.toInt)
    val ls=input.split("\n")(1).split(" ").map(_.toInt)
    ls.sortWith(_>_).take(k).sum.toString
  }
}


Measured memory_bytes: 27468
use proconio::input;

struct Solve {
    n: usize,
    k: u64,
    a: Vec<usize>,
}

impl Solve {
    fn new() -> Self {
        input! {
            n: usize, k: u64,
            mut a: [usize; n],
        }
        for x in &mut a {
            *x -= 1;
        }
        Self { n, k, a }
    }

    fn cycle(&self) -> (u64, u64) {
        let mut check: Vec<isize> = vec![-1; self.n];
        let mut idx = 0;
        check[idx] = 0;

        while check[self.a[idx]] == -1 {
            check[self.a[idx]] = check[idx] + 1;
            idx = self.a[idx];
        }
        // dbg!(&check);

        let x = check[self.a[idx]];
        let y = check[idx] - check[self.a[idx]] + 1;
        (x as u64, y as u64)
    }

    fn restore(&self, a: u64, b: u64) -> usize {
        let mut counter = a + b;
        let mut idx = 0;
        while counter > 0 {
            idx = self.a[idx];
            counter -= 1;
        }
        idx
    }

    fn solve(&self) {
        let (x, y) = self.cycle();
        // dbg!(x, y);
        let (a, b) = if x >= self.k {
            (self.k, 0)
        } else {
            (x, (self.k - x) % y)
        };
        // dbg!(a, b);
        println!("{}", self.restore(a, b) + 1);
    }
}

fn main() {
    Solve::new().solve();
}


Measured memory_bytes: 6388
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	long long K, A, B;
	cin >> K >> A >> B;

	long long ans = K + 1;
	bool flag = (B-A <= 2) || (A-1+2 > K);
	if(!flag){
		K -= A-1+2;
		long long bisc = B;

		long long cnt = K / 2;
		K %= 2;
		bisc += (B-A) * cnt;

		bisc += K;

		ans = max(ans, bisc);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

signed main() {
  INIT;
	VAR(int, n);
	VEC(int, p, n);
	sort(ALL(p));
	int ans = 0;
	REP(i, n) {
		if (i < n - 1) ans += p[i];
		else ans += p[i] / 2;
	}
	OUT(ans)BR;
  return 0;
}


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

using namespace std;
int main()
{
    int N;
    cin >> N;
    if(N<3)
    {
        cout << 0;
        return 0;
    }
    vector<int> L(N);
    for (int i = 0; i < N; i++)
    {
        cin >> L[i];
    }

    int count = 0;
    for (int i = 0; i < N; i++)
    {
        for(int j = i+1; j < N; j++)
        {
            for (int k = j + 1; k < N;k++)
            {
                if ((L[i] != L[j]) && (L[j] != L[k]) && (L[i] != L[k])&& (abs(L[i]-L[j])<L[k]) && (L[k]<(L[i]+L[j])))
                {
                    //cout << L[i] << L[j] << L[k] << endl;
                    //cout << i+1 << j+1 << k+1 << endl;
                    count++;
                }
            }
        }
    }
    cout << count;
    return 0;
}

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

template<typename T> struct Dijkstra {
  struct Edge { int to; T cost; };
  vector<int> prev;
  vector<vector<Edge>> g;
  Dijkstra(int n) : prev(n, -1), g(n) {}

  void addEdge(int u, int v, T w) {
    g[u].push_back({v, w});
    g[v].push_back({u, w});
  }
  vector<T> build(int s) {
    vector<T> dist(g.size(), -1);
    using Node = pair<T, int>;
    priority_queue<Node, vector<Node>, greater<Node>> pq;
    pq.push({dist[s] = 0, s});

    while (!pq.empty()) {
      auto d = pq.top().first;
      auto u = pq.top().second;
      pq.pop();
      if (dist[u] < d) continue;
      for (auto&& v : g[u]) {
        if (dist[v.to] < 0 || dist[v.to] > dist[u] + v.cost) {
          dist[v.to] = dist[u] + v.cost;
          prev[v.to] = u;
          pq.push({dist[v.to], v.to});
        }
      }
    }
    return dist;
  }
  vector<int> getPath(int t) {
    vector<int> path;
    for (; t != -1; t = prev[t]) path.push_back(t);
    reverse(begin(path), end(path));
    return path;
  }
};

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

  Dijkstra<int> g(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g.addEdge(a, b, 1);
  }
  auto d = g.build(0);
  int vmx = 0;
  for (int i = 0; i < n; i++) {
    if (d[vmx] < d[i]) vmx = i;
  }
  d = g.build(vmx);
  int l = 0;
  for (int i = 0; i < n; i++) {
    l = max(l, d[i]);
  }

  cout << (((l + 1) % 3 != 2) ? "First" : "Second") << endl;
}


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

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

int main(void) {
    int X;
    cin >> X;
    int t;
    for (t = X; t < 100000000; ++t) {
        if (isPrime(t)) {
            break;
        }
    }
    printf("%d\n", t);

    return 0;
}


Measured memory_bytes: 256
import numpy as np
list1 = np.array(map(int,raw_input().split()))
list2 = np.array(map(int,raw_input().split()))
list3 = np.array(map(int,raw_input().split()))
list4 = list1 - list2
list5 = list1 - list3
list6 = [list1[0] - list1[1],list2[0] - list2[1],list3[0] - list3[1]]
list7 = [list1[0] - list1[2],list2[0] - list2[2],list3[0] - list3[2]]
def checkline(list):
    return (list[0] - list[1])**2 + (list[0] - list[2])**2

if checkline(list4) == 0 and checkline(list5) == 0 and checkline(list6) == 0 and checkline(list7) == 0:
        print 'Yes'
else:
    print 'No'

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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
#define ALL(x) x.begin(),x.end()
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

ll N;

int main()
{
	scanf("%lld",&N);
	vector<ll> A(N);
	FOR(i,0,N){
		scanf("%lld",&A [i]);
	}
	ll sum = accumulate(ALL(A),0ll);
	if(sum % ((N + 1) * N / 2)){
		printf("NO\n");
		return 0;
	}
	ll t = sum / ((N + 1) * N / 2);

	vector<ll> B(N);
	FOR(i,0,N){
		int j = (i + 1) % N;
		if((A [i] - A [j] + t) % N == 0 && (A [i] - A [j] + t) / N >= 0){
			B [i] = (A [i] - A [j] + t) / N;
		}
		else{
			printf("NO\n");
			return 0;
		}
	}
	if(accumulate(ALL(B),0ll) == t){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}


	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
const int MAX = 1e5+5;
const int mod = 1e9+7;
vector<int> adj[MAX];
int N, K;
ll ans;

void dfs_solve(int u, int p) {
	int j = 0;
	int pai = (u != p);
	int sz = adj[u].size();
	rep(i, 0, sz) {
		int v = adj[u][i];
		if(v == p) continue;
		if((K - j - 1 - pai) <= 0) puts("0"), exit(0);
		ans = (ans * (K - j - 1 - pai)) % mod; 
		dfs_solve(v, u);
		j++;
	}
}

int main(int argc, char ** argv) {
	int u, v;
	scanf("%d%d", &N, &K);
	rep(i, 1, N) {
		scanf("%d%d", &u, &v);
		adj[u].pb(v); adj[v].pb(u);
	}
	ans = K;
	dfs_solve(1, 1);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 11520
from collections import deque
# 木構造を作る
N,M = map(int, input().split())

G = [[] for i in range(3*N)]
for i in range(M):
    # グラフに頂点を追加(距離があるときは,u,vの後に入れる)
    u,v = map(int,input().split())
    G[3*(u-1)].append((3*(v-1)+1))
    G[3*(u-1)+1].append((3*(v-1)+2))
    G[3*(u-1)+2].append((3*(v-1)))

S,T = map(int, input().split())

# 木をBFSをする
dist = [-1] * (3*N)
dist[3*(S-1)] = 0
q = deque([3*(S-1)])
while q:
    v = q.popleft()
    d = dist[v]
    Vs = G[v]
    for u in Vs:
        if dist[u] == -1:
            q.append(u)
            dist[u] = d + 1

ans = dist[3*(T-1)]
print(-1 if ans == -1 else ans//3)


Measured memory_bytes: 60100
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;

int main(void){
   int N;
   cin>>N;
   vector<string> S(N);
   for(int i=0;i<N;i++){
      cin>>S[i];
   }
   vector<vector<int>> cnt(26,vector<int>(N));
   for(int i=0;i<N;i++){
      for(int j=0;j<S[i].size();j++){
         cnt[S[i][j]-'a'][i]++;
      }
   }
   int ans[26];
   for(int i=0;i<26;i++){
      ans[i]=10000;
   }
   for(int i=0;i<26;i++){
      for(int j=0;j<N;j++){
         ans[i]=min(ans[i],cnt[i][j]);
      }
   }
   for(int i=0;i<26;i++){
      for(int j=0;j<ans[i];j++){
         char s='a'+i;
         cout<<s;
      }
   }
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>

int main(){
unsigned int A, B;
std::cin >> A >> B;

A = (A == 1 ? 14 : A);
B = (B == 1 ? 14 : B);

if (A == B){
std::cout << "Draw" << std::endl;
}
else if (A > B){
std::cout << "Alice" << std::endl;
}
else {
std::cout << "Bob" << std::endl;
}

return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mes(a, b)  memset(a, b, sizeof a)
#define pb push_back
typedef unsigned long long int ull;
typedef long long int ll;
const int    maxn = 2e5 + 20;
const int    maxm = 1e5 + 10;
const ll     mod  = 1e9 + 7;
const ll     INF  = 1e18 + 100;
const int    inf  = 0x3f3f3f3f;
const double pi   = acos(-1.0);
const double eps  = 1e-8;
using namespace std;
int main(){
	ll n,k;cin >> n >> k;
	ll ans = 0;
	for(ll i = k;i <= n + 1;i++){
		ans += (n + n - i + 1) * i / 2 - (i - 1) * i / 2 + 1;
		ans %= mod;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace  std;
template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

  
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<pii>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define re(n) for (int i = 0; i < n; ++i)
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define eb emplace_back

//OutPut
#define ps(x) cout << x << endl;
#define ps_end(x) {ps(x); return;}


const int md = 1e9 + 7; //998244353 ;
const int dir[4][2] = {{-1,0}, {1, 0}, {0, -1}, {0, 1}};
template<class T> bool ckmin(T& a, const T& b) { 
  return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { 
  return a < b ? a = b, 1 : 0; }
ll pw(auto x, auto y) {  ll s = 1; while(y) { if (y & 1) s = s * x % md; x= 1LL * x * x % md; y /= 2; } return s;}

const int maxn = 1e6 + 10;

int n, m, nq, nk;
string str;

void task() {
  cin >> n;
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j * i <= n; ++j) {
       if (n - j * i) ans++;
    }
  }
  cout << ans << endl;
  //Read the stuff at the bottom
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout<<fixed<<setprecision(20);
  int T = 1;
  //cin >> T;
  for (int ti = 1; ti <= T; ++ti) {
    task();
  }
  return 0;
}

/* stuff you should look for
  * int overflow, array bounds
  * special cases (n=1?)
  * do smth instead of nothing and stay organized
  * write down
*/


Measured memory_bytes: 3648
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

int main() {
	int n, m, x;
	int a[100];
	cin >> n >> m >> x;
	rep(i, m) cin >> a[i];
	int cnt_a = 0;
	int cnt_b = 0;
	rep(i, m){
		if (a[i] < x) ++cnt_a;
	}

	rep(j, m) {
		if (x < a[j] && a[j] < n) ++cnt_b;
	}

	if (cnt_a < cnt_b) cout << cnt_a << endl;
	else if(cnt_b < cnt_a) cout << cnt_b << endl;
	else if (cnt_a == 0 && cnt_b == 0) cout << 0 << endl;
	return 0;
}

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

int main() {
    int N;
    int d[101];
    cin >> N;
    for (int i=0; i<N; i++) cin >> d[i];
    
    int num[101] = {0};
    for (int i=0; i<N; i++) num[d[i]]++;
    
    int res = 0;
    for (int i=1; i<=100; i++)
        if (num[i]) res++;
    cout << res << endl;
}


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

int main(){
  int m1,d1, m2, d2;
  cin >> m1 >> d1;
  cin >> m2 >> d2;
  
  if(d2 == 1){
    cout << "1" << endl;
  }
  else{
    cout << "0" << endl;
  }
 
  
  return 0;
}

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

int main(){
  lint N;
   lint w;
  cin >>N;
  repp(h,1,3500){
    repp(n,1,3500){
      lint p=N*h*n;
   lint q=4*h*n-N*(n+h);
      if(q>0 && p%q==0){
        cout <<h<<" "<<n<<" "<<p/q;
        return 0;
      }
    }
  }
   
}


  


Measured memory_bytes: 256
/*	ex7_3
	suzuto	*/

  #include <stdio.h>
  #include <stdlib.h>

  int main(void){
    char **grid_ptr, ins; /*変数の宣言*/
    int *height_ptr, *width_ptr, height, width, i, j;

    scanf("%d %d", &height, &width); /*館横の長さを入力*/
    height_ptr = (int*)calloc(height, sizeof(int)); /*圧縮後に残る行を記憶*/
    if(height_ptr == NULL){ /*エラー出力*/
      fprintf(stderr, "Memory allocation error.\n");
      return 1;
    }
    for(i = 0; i < height; i++){
      height_ptr[i] = 0; /*height_ptrを初期化*/
    }
    width_ptr = (int*)calloc(width, sizeof(int)); /*圧縮後に残る列を出力*/
    if(width_ptr == NULL){ /*エラー出力*/
      fprintf(stderr, "Memory allocation error.\n");
      return 1;
    }
    for(i = 0; i < width; i++){
      width_ptr[i] = 0; /*width_ptrを初期化*/
    }
    grid_ptr = (char**)calloc(height, sizeof(char*)); /*char*型配列を確保*/
    if(grid_ptr == NULL){ /*エラー出力*/
      fprintf(stderr, "Memory allocation error.\n");
      return 1;
    }
    for(i = 0; i < height; i++){
      grid_ptr[i] = (char*)calloc(width, sizeof(char)); /*char型配列を確保し入力を記憶する二次元配列が完成*/
      if(grid_ptr[i] == NULL){ /*エラー出力*/
        fprintf(stderr, "Memory allocation error.\n");
        return 1;
      }
    }
    for(i = 0; i < height; i++){
      for(j = 0; j < width; j++){
        scanf(" %c", &ins); /*入力insに一時的に記憶*/
        grid_ptr[i][j] = ins; /*入力を記憶用の配列に反映*/
        if(ins == '#'){ /*黒のある行、および列は圧縮により消えない*/
          height_ptr[i] = 1;
          width_ptr[j] = 1;
        }
      }
    }
    for(i = 0; i < height; i++){
      if(height_ptr[i] == 1){ /*height_ptrが初期値でないときその行は残る*/
        for(j = 0; j < width; j++){
          if(width_ptr[j] == 1){ /*width_ptrが初期値でないときその列は残る*/
            printf("%c", grid_ptr[i][j]); /*この点は残っているので出力*/
          }
        }
        printf("\n");
      }
    }

    /*各々の使用済みの動的確保した破裂を解放*/
    free(height_ptr);
    free(width_ptr);
    for(i = 0; i < height; i++){
      free(grid_ptr[i]);
    }
    free(grid_ptr);
    return 0;
  }


Measured memory_bytes: 1660
mod = 1000000007
l = input().split()
m = int(l[0])
n = int(l[1])


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y/2)**2 % mod
    else:
        return power(x, int(y/2))**2 * x % mod


ans = power(m, n)
print(ans)




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

int main(){
  int n,k;
  string s;
  
  cin >>n>>k>>s;
  
  if(s.at(k-1) == 'A')
    s.at(k-1) = 'a';
  if(s.at(k-1) == 'B')
    s.at(k-1) = 'b';
  if(s.at(k-1) == 'C')
    s.at(k-1) = 'c';
  
  cout <<s<<endl;
}

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

int n;
long long c[500];
long long s[500];
long long f[500];

int main(){
    cin >> n;
    for(int i = 0; i < n - 1; i++){
        cin >> c[i] >> s[i] >> f[i];
    }
    for(int i = 0; i < n - 1; i++){
        long long sum = 0;
        for(int j = i; j < n - 1; j++){
            if(sum < s[j]){
                sum = s[j];
            }
            if(sum % f[j] != 0){
                sum += f[j] - sum % f[j];
            }
            sum += c[j];
        }
        cout << sum << endl;
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[]args) throws Throwable {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int a = sc.nextInt(), b = sc.nextInt();
		if (a + b == 15) {
			System.out.println("+");
			return;
		}
		if (a * b == 15) {
			System.out.println("*");
			return;
		}
		System.out.println("x");
		
		out.flush();
		out.close();

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String s) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(new File(s)));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}
}


Measured memory_bytes: 20564