akhauriyash/Code-Regression huggingface dataset:
/* Use the slash-star style comments or the system won't see your
   identification information */
/*
ID: khozmos1
TASK: beads
LANG: C++11
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include <bits/stdc++.h>

using namespace std;

// Header files, namespaces,
// macros as defined above
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define f first
#define s second
#define pos first.first
#define tip first.second
#define id second
#define db long double
#define pb push_back
#define sz(c) (int)(c).size()
#define all(c) (c).begin(),(c).end()

typedef long long ll;
typedef pair <int , int> ii;
typedef pair <ii , int> iii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <iii> viii;
typedef vector <vi> vvi;
typedef vector <vii> vvii;




const int mod = 20011;
const int MAX = 3e5+5;
const db eps = 1e-13;
const ll oo = 1e18;

// basic operations
int mul( int a , int b ) {
    return (1ll*a*b)%mod;
}
void addSelf( int &a , int b , int m ) {
    a = (a+b)%m;
}


int ST[4*MAX] , lazy[4*MAX];
int mn[MAX] , mx[MAX];

void propagate( int node , int x, int y , int mt ) {
    ST[node*2] += (lazy[node]*(mt-x+1));
    ST[node*2+1] += (lazy[node]*(y-mt));
    lazy[node*2] += lazy[node];
    lazy[node*2+1] += lazy[node];
    lazy[node] = 0;
}

void update( int node , int x , int y , int a, int b , int v ) {

    if( y < a || x > b )
        return;
    if( x >= a && y <= b ) {
        ST[node] += (v*(y-x+1));
        lazy[node] += v;
        return;
    }
    int mt = (x+y)>>1;
    if( lazy[node] != 0 )
        propagate(node,x,y,mt);
    update(node*2,x,mt,a,b,v);
    update(node*2+1,mt+1,y,a,b,v);
}

int query( int node , int x , int y, int a, int b ) {
    if( y < a || x > b )
        return 0;
    if( x >= a && y <= b ) {
        return ST[node];
    }
    int mt = (x+y)>>1;
    if( lazy[node] != 0 )
        propagate(node,x,y,mt);

    return query(node*2,x,mt,a,b)+query(node*2+1,mt+1,y,a,b);
}


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int W, H ,N;
    cin>>W>>H>>N;

    W = max( W, H );
    cout<<1*(N%W!=0)+(N/W)<<"\n";


}
/*
2 3 7 18 3
2 3 3 3 4 3 4 1 1 1 1 1 2 2 2 3 3 4
*/


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

const int MOD = 1000000007;
const char NL = '\n';

void solve()
{
    int n; cin >> n;
    vector<int> v;
    for (int i = 0; i < n; ++i) {
        int h; cin >> h;
        v.push_back(h);
    }
    vector<int> dp(n, 0);
    dp[1] = abs(v[1] - v[0]);
    for (int i = 2; i < n; ++i) {
        dp[i] = min(dp[i - 1] + abs(v[i] - v[i - 1]), dp[i - 2] + abs(v[i] - v[i - 2]));
    }
    cout << dp[n - 1] << NL;
}

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

Measured memory_bytes: 4188
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}

int dp[101010],n,m;

signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
        cin >> n >> m;
        for(int i=1;i<=m;i++){
                int x;
                cin >> x;
                dp[x]=-1;
        }
        dp[0]=1;
        for(int i=0;i<=n;i++){
                /*if( i-1>=0 && dp[i-1]!=-1 ){
                        dp[i] = (dp[i-1]+dp[i])%mod;
                }
                if( i-2>=0 && dp[i-2]!=-1 ){
                        dp[i] = ( dp[i] + dp[i-2] )%mod;
                }
                cout << dp[i] << endl;
                */
                if(dp[i]>0){
                        if(dp[i+1]!=-1)
                        dp[i+1] = ( dp[i]+dp[i+1] )%mod;
                        if(dp[i+2]!=-1)
                        dp[i+2] = ( dp[i]+dp[i+2] )%mod;
                }
        }
        cout << dp[n] << endl;

return 0;
}
///....


Measured memory_bytes: 1024
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	string s;
	cin >> s;
	
	// 解法
	string abc = "abcdefghijklmnopqrstuvwxyz";
	ll min_gap = s.size();
	REP(i,26){
		ll max_gap = 0;
		ll gap = 0;
		REP(j,s.size()){
			if (s[j]==abc[i])gap = 0;
			else gap++;
			if (gap>max_gap) max_gap = gap;
		}
		if (max_gap<min_gap) min_gap = max_gap;
	}
	
	//出力
	cout << min_gap << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <set>
#include <algorithm>
using namespace std;
int min(int x, int y) {
	return x < y ? x : y;
}
int main() {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	int mi = min(a - b, c);
	printf("%d", c - mi);
}

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

typedef long long ll;

#define rep(i,n) for(int i = 0; i < n; i++)

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> a(N);
  ll s = 0;
  int cnt = 0;
  rep(i,N) {
    cin >> a[i];
    s += a[i];
  }
  rep(i,N) {
    if (4*a[i]*M >= s) cnt++;
  }
  if (cnt >= M) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

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

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

    vector<int> P(N);
    for (int i = 0; i < N; i++)
        cin >> P[i];

    vector<int> p(P);
    for (int i = 1; i < N; i++)
        p[i] = min(p[i - 1], p[i]);

    int cnt = 0;
    for (int i = 0; i < N; i++)
        if (P[i] <= p[i])
            cnt++;

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 1792
X, K, D = map(int, input().split())
ans = 10 ** 19
X = abs(X)
if X >= K * D:
    print(X - K * D)

else:
    c = X // D
    if (K - c) % 2 == 0:
        print(X - c * D)
    else:
        print(D * (c + 1) - X)

Measured memory_bytes: 61912
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<math.h>
#include<stdlib.h>
#include <iomanip>
using namespace std;
#define int long long
//#define double long double
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;
typedef pair<int, pii > pip;
typedef pair<pii, pii > piipii;
typedef pair<double, double> pdd;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define all(vec) vec.begin(), vec.end()
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60)
#define mod 1000000007
#define se second
#define fi first

int N;

signed main(){
    cin >> N;
    int ans = -1;
    for(int i = 0; i <= N; i++){
        if(N == (int)(i * 1.08)){
            ans = i;
        }
    }
    if(ans >= 0)cout << ans << endl;
    else cout << ":(" << endl;
    
    
    return 0;
}

/*

*/

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

int search(int A[], int n, int key)
{
  int left = 0;
  int right = n;
  while (left < right)
  {
    int mid = (left + right) / 2;
    if (A[mid] == key)
    {
      return 1;
    }
    else if (key < A[mid])
    {
      right = mid;
    }
    else
    {
      left = mid + 1;
    }
  }
  return 0;
}

int main()
{
  int n;
  scanf("%d", &n);
  int S[n];
  for (int i = 0; i < n; i++)
  {
    scanf("%d", &S[i]);
  }
  int q;
  scanf("%d", &q);
  int T[q];
  for (int i = 0; i < q; i++)
  {
    scanf("%d", &T[i]);
  }
  int cnt = 0;
  for (int i = 0; i < q; i++)
  {
    cnt += search(S, n, T[i]);
  }

  printf("%d\n", cnt);
  return 0;
}



Measured memory_bytes: 3772
let () = Scanf.scanf "%d\n" @@ fun n ->
  let hs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun h -> h in
  let acc = Array.make n 0 in
  for i = n - 2 downto 0 do
    if hs.(i + 1) <= hs.(i) then
      acc.(i) <- acc.(i + 1) + 1
  done;
  Printf.printf "%d\n" @@ Array.fold_left max min_int acc


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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;

int main() {
	string S;
	cin >> S;
	int N = S.length();

	ll ans = 0;
	for (int bit = 0 ; bit < (1 << (N - 1)) ; bit++) {
		string tmp = "";
    	ll sum = 0;
    	ll num = S[0] - '0';
    	for (int i = 0 ; i < N - 1 ; i++) {
			if ((bit >> i) & 1) {
        		sum += num;
        		num = 0;
			}
      		num = num * 10 + S[i+1] - '0';
    	}
    	sum += num;
    	ans += sum;
	}

	cout << ans << 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 erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 1000000009
using P = pair<int,int>;
 
int main() {
  #define int long long
  int k;
  cin >> k;
  int num = 0,sum = 0;
  while(sum < k){
    num++;
    sum += num;
  }
  vint ans(0);
  while(k > 0){
    if(num < k){
      ans.push_back(num);
      k -= num;
      num--;
    }
    else{
      ans.push_back(k);
      k -= k;
    }
  }
  for(int i = ans.size()-1;i >= 0;i--) cout << ans[i] << endl;
} 

Measured memory_bytes: 384
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

#define int long long

template<typename A, size_t N, typename T>

void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここにグローバル変数宣言

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数宣言


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

string S,T;
int cnt=0;
cin>>S>>T;

REP(i,S.size()){
	if (S[i]!=T[i])
	{
		cnt++;
	}
}
cout<<cnt<<endl;



}

Measured memory_bytes: 3776
/*When I wrote this, only God and I understood what I was doing
Now, God only knows*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
 
 
//#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
 
 
#define boost ios::sync_with_stdio(false); cin.tie(nullptr);
#define MOD 1000000007
#define sd(x) scanf("%d", &(x))
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ones(x) __builtin_popcount(x)
#define sz(x) int (x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define REP(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define f1(i,a,b) for(int i=a; i<=b; i++)
#define rep(i,a,b) for(int i=a; i<b; i++)
#define NFOR(i,a,b) for(int i=(a);i>=(b);--i)


using ll = long long ;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;  
typedef double ld;
typedef vector<ll> vll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
 
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
 
#ifdef np
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif
 
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
 
void solve(){
	int k , x ;
	sd(k);sd(x);
	vi ans ;
	int a =x-k+1;
	for(int i= a ; i<x+k ; ++i) ans.pb(i);
	for(auto H : ans )
		cout<<H<<" ";

}

signed main(){
	int T =1 ; 
	//sd(T);
	while(T--){
		solve();
	}

#ifdef np
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}

Measured memory_bytes: 256
package main

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

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt int

func main() {
	reader.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())
	arr := make([][]string, N)
	for i := 0; i < N; i++ {
		t := read()
		arr[i] = make([]string, len(t))
		for j := 0; j < len(t); j++ {
			arr[i][j] = string(t[j])
		}
		sort.Sort(sort.StringSlice(arr[i]))
	}
	str := make([]string, N)
	for i := 0; i < N; i++ {
		str[i] = strings.Join(arr[i], "")
	}
	sort.Sort(sort.StringSlice(str))

	for i := 0; i < N-1; i++ {
		if str[i] != str[i+1] {
			for j := cnt; 0 < j; j-- {
				ans += j
			}
			cnt = 0
		} else {
			cnt++
		}
	}
	for j := cnt; 0 < j; j-- {
		ans += j
	}
	fmt.Println(ans)
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; 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
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []uint64

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 30208
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;



int re[10001][1300];
int N,M;


int main(){
  while(1){
    memset(re,0,sizeof(re));
    int r,q,t,n,m,s,ts,te;
    scanf("%d%d",&N,&M);
    if(N+M==0) break;
    scanf("%d",&r);
    rep(i,r){
      scanf("%d%d%d%d",&t,&n,&m,&s); m--;
      if(s) re[m][t]++;
      else re[m][t]--;
    }

    rep(i,10000){
      rep(j,1270) re[i][j+1] += re[i][j];
    }

    scanf("%d",&q);
    rep(i,q){
      scanf("%d%d%d",&ts,&te,&m); m--;
      int res = 0;
      for(int j=ts;j<te;j++) if(re[m][j]>0) res++;
      //      for(int j=ts;j<te;j++) cout << re[m][j] << " "; cout << endl;
      printf("%d\n", res);
    }
  }
  return 0;
}

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

int main()
{
    long long int n,s=0,i;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        if(i%3!=0 && i%5!=0)
        {
            s+=i;
        }
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
const int MAX_N=1e5+1; const ll OO=1e11;
int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n,ac=0,wa=0,tle=0,re=0; cin>>n; string s;
 while(n--){
     cin>>s;
     if(s=="WA")wa++;
     else if(s=="TLE")tle++;
     else if(s=="RE")re++;
     else  ac++;
 }
 cout<<"AC x "<<ac<<endl;
 cout<<"WA x "<<wa<<endl;
 cout<<"TLE x "<<tle<<endl;
 cout<<"RE x "<<re;
}

Measured memory_bytes: 3648
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  int m = 170000;
  vi x(m), y(m);
  int k = 0;

  for (int i = 1; i < n; i += 3) {
    for (int j = (i % 2 == 1) ? 0 : 1; j < n; j += 2) {
      x[k] = i;
      y[k] = j;
      k += 1;
    }
  }
  if (n % 3 == 1) {
    for (int i = ((n-1) % 2 == 1) ? 0 : 1; i < n; i += 2) {
      x[k] = n-1;
      y[k] = i;
      k += 1;
    }
  }
  rep (i, n-1) {
    if (i % 2 == 0 || i % 3 == 1) {
      continue;
    }
    x[k] = i;
    y[k] = 0;
    k += 1;
  }
  printf("%d\n", k);
  rep (i, k) {
    printf("%d %d\n", x[i], y[i]);
  }

  return 0;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
const double PI=3.14159265358979323846;

int main(){
  double A, B, H, M;
  cin>>A>>B>>H>>M;
  
  double a1 = 360*(H*60+M)/(12*60);
  double a2 = 6*M;
  
  // cout<<a1<<' '<<a2<<endl;
  double diff=abs(a1-a2);
  diff = min(diff, 360-diff);
  
  // const double PI = acos(-1);
  double ans_2 = A*A + B*B - 2*A*B*cos(diff*PI/180);
  
  cout<<fixed<<setprecision(20)<<sqrt(ans_2)<<endl;
}

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

// DP テーブル (配列全体が false に自然に初期化される)
bool dp[110000]; // 局面数は最大 100001 だが少し余裕もたせる

int main() {
    // 入力受け取り
    int N, K; cin >> N >> K;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];

    // DP
    for (int i = 1; i <= K; ++i) {
        for (int j = 0; j < N; ++j) {
            if (i - a[j] >= 0) dp[i] |= !dp[i - a[j]];
        }
    }

    // 答え
    if (dp[K]) cout << "First" << endl;
    else cout << "Second" << endl;
}

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

#define max 1000

int left(int k) {
    return 2 * k;
}

int right(int k) {
    return 2 * k + 1;
}

int parent(int k) {
    return k / 2;
}

int main() {
    int H;
    int A[max + 1];
    int l, r, p;
    cin >> H;
    for (int i = 1; i <= H; i++) {
        cin >> A[i];
    }

    for (int i = 1; i <= H; i++) {
        cout << "node " << i << ": " << "key = " << A[i] << ", ";
        p = parent(i);
        l = left(i);
        r = right(i);
        if (1 <= p && p <= H) {
            cout << "parent key = " << A[p] << ", ";
        }
        if (1 <= l && l <= H) {
            cout << "left key = " << A[l] << ", ";
        }
        if (1 <= r && r <= H) {
            cout << "right key = " << A[r] << ", ";
        }
        cout << "\n";
    }
    return 0;
}



Measured memory_bytes: 3108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC061A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;

            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);

            if (a <= c && c <= b)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

            Console.ReadKey();
        }
    }
}


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

int D[40][40] = {0};
int c[510][510] = {0};

int main(){
	int N, C;
	cin >> N >> C;
	for (int i = 1; i <= C; i++){
		for (int j = 1; j <= C; j++){
			cin >> D[i][j];
		}
	}
	for (int i = 1; i <= N; i++){
		for (int j = 1; j <= N; j++){
			cin >> c[i][j];
		}
	}

	vector<int> x0(C+1, 0);
	vector<int> x1(C+1, 0);
	vector<int> x2(C+1, 0);
	for (int color = 1; color <= C; color++){
		for (int i = 1; i <= N; i++){
			for (int j = 1; j <= N; j++){
				if ((i+j)%3 == 0){
					x0[color] += D[c[i][j]][color];
				} else if ((i+j)%3 == 1){
					x1[color] += D[c[i][j]][color];
				} else {
					x2[color] += D[c[i][j]][color];
				}
			}
		}
	}

	int res = 1<<30;
	for (int i = 1; i <= C; i++){
		for (int j = 1; j <= C; j++){
			if (j == i) continue;
			for (int k = 1; k <= C; k++){
				if ((k == i) || (k == j)) continue;

				res = min(res, x0[i]+x1[j]+x2[k]);
			}
		}
	}

	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll N =2e5+5;
ll n,m,k,ans=0;
ll a[N],b[N];
int main(){
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>m>>k;
    for(ll i=1;i<=n;i++){
      cin>>a[i];
      a[i]+=a[i-1];
    }
    for(int i=1;i<=m;i++){
      cin>>b[i];
      b[i]+=b[i-1];
    }
    ll ans=0;
    ll idx=m;
    for(ll i=0;i<=n;i++){
      if(a[i]>k)
      break;
      while(a[i]+b[idx]>k)
      idx--;
      ans=max(ans,i+idx);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = (int)1e9 + 7;
const int INF = (int)100100100;

int main() {
    //にゃんこスター
    ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int sum=0;
    int ren=1;
    int A[N];
    cin >> A[0];
    for(int i=1;i<N;i++){
        cin >> A[i];
        if(A[i]==A[i-1])ren++;
        else{
            sum+=ren/2;
          cerr << ren;
            ren=1;
        }
    }
  sum+=ren/2;
    


    cout << sum << endl;
}

/*



 */



Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

// doot diddly donger cuckerino Hahahahahah
// Created by White Knife on 15/04/20.
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC target("popcnt")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;

// @formatter:off
#define F               first
#define S               second
#define all(x)          (x).begin(), (x).end()
#define sz(x)           (long long) (x).size()
#define sim             template<typename T
#define ris             return *this
#define dor             > debug & operator <<
#define eni(x)          sim > typename enable_if<sizeof dud<T>(0) x 1, debug&>::type operator<<(T i)
sim> struct rge { T b, e; };
sim> rge<T> range(T i, T j) { return rge<T>{i, j}; }
sim> auto dud(T *x) -> decltype(cerr << *x, 0);
sim> char dud(...);
struct debug {
#ifdef LOCAL
  ~debug() { cerr << endl; }
  eni(!=) { cerr << boolalpha << i; ris; }
  eni(==) { ris << range(all(i)); }
  sim, typename U dor(pair<U, T> d) { ris << "(" << d.first << ", " << d.second << ")"; }
  sim dor(rge<T> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
  sim dor(const T&) { ris; }
#endif
};
#define pr(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vb = vector<bool>;

using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const ld PI = acos(-1);

template <typename T> T gcd(T x, T y) { return (y == 0) ? x : gcd(y, x % y); }
template<typename T> inline T mini(T& x, T y) { return x = min(x, y); }
template<typename T> inline T maxi(T& x, T y) { return x = max(x, y); }
template <typename T> T rand(T x, T y) { return rand() % (y - x + 1) + x; }
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
// @formatter:on


class EThisMessageWillSelfDestructIn5s {
public:
  
  void solve(std::istream &cin, std::ostream &cout) {
    int n;
    cin >> n;
    vector<long long> a(n, 0);
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      a[i] -= i;
    }
    ll ans = 0;
    map<ll, ll> mp;
    mp[a.back()]++;
    for (int i = n - 2; i >= 0; --i) {
      ll box = -a[i] - 2 * i;
      ans += mp[box];
      mp[a[i]]++;
    }
    cout << ans << '\n';
  }
};

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
	EThisMessageWillSelfDestructIn5s solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 27508
#include<iostream>
using namespace std;
int main()
{
    char a,b;
    cin>>a>>b;
    if(a=='H')
    {
        if(b=='H')
            cout<<"H";
        else
            cout<<"D";
    }
    else
    {
        if(b=='H')
            cout<<"D";
        else
            cout<<"H";
    }
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
const ll INF = 1e18;

int dy[] = {0, 1, 0, -1};
int dx[] = {1, 0, -1, 0};

int main(){
    int h, w, black = 0;
    cin >> h >> w;
    char grid[60][60];
    int d[60][60];
    for(int i = 0; i < h; i++) for(int j = 0; j < w; j++){
        cin >> grid[i][j];
        if(grid[i][j] == '#') black++;
        d[i][j] = -1;
    }
    d[0][0] = 0;
    queue<pii> que;
    que.push({0,0});
    while(!que.empty()){
        pii p = que.front(); que.pop();
        int y = p.fi, x = p.se;
        for(int i = 0; i < 4; i++){
            int nx = x + dx[i], ny = y + dy[i];
            if(nx < 0 || ny < 0 || nx >= w || ny >= h)continue;
            if(grid[ny][nx] == '#' || d[ny][nx] >= 0) continue;
            que.push({ny, nx});
            d[ny][nx] = d[y][x] + 1;
        }
    }
    if(d[h-1][w-1] == -1) cout << -1 << endl;
    else cout << h*w - d[h-1][w-1] - 1 - black << endl;
    return 0; 
}

Measured memory_bytes: 256
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=chomp(readline())
    println(ifelse("abc"==join(sort(collect(s))),"Yes","No"))
end
main()

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

int main(){
    string s;
    cin >> s;
    for(int i=s.size()/2-1;i>0;i--){
        int count=0;
        for(int j=0;j<i;j++){
            if(s[j]==s[j+i])
            count++;
        }
        if(count==i){
            cout << i*2 << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int A, B; cin >> A >> B;
    if(A == 1) A = 14;
    if(B == 1) B = 14;
    if(A > B) cout << "Alice" << endl;
    else if(A < B) cout << "Bob" << endl;
    else cout << "Draw" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define DB long double
struct point{
	DB x,y;
}a,b,c;
DB dis(point a,point b){
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
DB area(DB p1,DB p2,DB p3){
	DB p=(p1+p2+p3)/2;
	return sqrt(p*(p-p1)*(p-p2)*(p-p3));
}

bool check(DB d){
	DB p[3]={dis(a,b),dis(b,c),dis(c,a)};DB r=1,h;
	for(int i=0;i<3;i++){
		h=area(p[0],p[1],p[2])*2/p[i]*r;
		if(h<d) return false;
		r*=(h-d)/h;
	}
	return max(p[0],max(p[1],p[2]))*r>d*2;
}

int main(){
	cin>>a.x>>a.y>>b.x>>b.y>>c.x>>c.y;
	DB l=0,r=1e3;
	while(r-l>1e-10){
		DB mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	printf("%.10lf",(double)l);
	return 0;
}

Measured memory_bytes: 384
import java.util.*;


//素数探索
class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		int sum=0,count=0,i=0;
		for(;sc.hasNext();i++) {
			String[] data=sc.next().split(",");
			sum+=Integer.parseInt(data[0])*Integer.parseInt(data[1]);
			count+=Integer.parseInt(data[1]);
		}
		ln(sum);
		ln(Math.round((double)count/i));
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

Measured memory_bytes: 12000
n = int(input())
l = []
for i in range(n):
	s, p = input().split()
	p = int(p)
	l.append([s, p, i+1])

l.sort(key=lambda x:x[1], reverse=True)
l.sort(key=lambda x:x[0])

for e in l:
	print(e[2])

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int f[200010];
int n;

char x[200010];
int posCountL;
int posCount;	//原始数据 
int posCountH;
int remL[200010];	//对 -1的数据 
int remM[200010];	//对 原始数据 
int remH[200010];	//对 +1的数据 
int curRemL;
int curRemH;


int doRevert(int pos) {
	if (x[pos] == '0') {
		x[pos] = '1';
		return 1;
	} else {
		x[pos] = '0';
		return -1;
	}
}

int getF(int num) {
	if (f[num] != -1)
		return f[num];
	
	int count = 0;
	int theNum = num;
	while (theNum > 0) {
		int r = theNum % 2;
		count = count + r;
		theNum = theNum / 2;
	}
	
	int target = num % count;
	f[num] = getF(target) + 1;
	return f[num];
}

int main()
{
	for (int i = 0 ; i < 200010 ; i++)
		f[i] = -1;
	f[0] = 0;
	f[1] = 1;
	
	scanf("%d\n", &n);
	scanf("%s\n", x);
	
	if ((n == 1) && (x[0] == '1')) {
		printf("0\n");
		return 0;
	}
	
	posCount = 0;
	for (int i = 0 ; i < n ; i++) {
		if (x[i] == '1')
			posCount++;
	}
	posCountL = posCount - 1;
	posCountH = posCount + 1;
	remL[0] = 1;
	remM[0] = 1;
	remH[0] = 1;
	for (int i = 1 ; i <= n ; i++) {
		if (posCountL > 0) {
			remL[i] = (remL[i - 1] * 2) % posCountL;			
		}
		if (posCount > 0) {
			remM[i] = (remM[i - 1] * 2) % posCount;
		}

		remH[i] = (remH[i - 1] * 2) % posCountH;
	}

	curRemL = 0;
	curRemH = 0;
	for (int i = 0 ; i < n ; i++) {
		curRemL = curRemL * 2;
		curRemH = curRemH * 2;
		if (x[i] == '1') {
			curRemL++;
			curRemH++;
		}
		
		if (posCountL > 0) {
			curRemL = curRemL % posCountL;
		}
		
		curRemH = curRemH % posCountH;
	}


	
	int realBase;
	int realRem;
	int ans;
	for (int i = 0 ; i < n ; i++) {
		realBase = n - i - 1;
		int diff = doRevert(i);
		if (diff == -1) {
			if (posCountL == 0) {
				ans = 0;
			} else {
				//L侧 
				realRem = curRemL + posCountL - remL[realBase];
				realRem = realRem % posCountL;
				ans = getF(realRem) + 1;
			}
		} else {	//1
			realRem = curRemH + remH[realBase];
			realRem = realRem % posCountH;
			ans = getF(realRem) + 1;
		}
		
		printf("%d\n", ans);
		
		doRevert(i);
	}
	
	
	return 0;
}


Measured memory_bytes: 5052
#define SUBMIT

#include <bits/stdc++.h>

using namespace std;

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

template <typename T>
int bubble_sort(vector<T>& a) {
    int swap_count = 0;
    bool swap_flag = true;
    while (swap_flag) {
        swap_flag = false;
        for (int j = a.size() - 1; j >= 1; --j) {
            if (a[j] < a[j - 1]) {
                swap(a[j], a[j - 1]);
                swap_flag = true;
                swap_count++;
            }
        }
    }

    return swap_count;
}

int main() {
#ifdef SUBMIT
    auto& in = cin;
#else
    stringstream in(R"(6
5 2 4 6 1 3
)");
#endif
    int n;
    in >> n;
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        int temp;
        in >> temp;
        a.push_back(temp);
    }

    auto swap_count = bubble_sort(a);
    print_array(a);
    cout << swap_count << endl;
    return 0;
}


Measured memory_bytes: 3160
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int a; 
    scanf("%d", &a);
    
    if(a<1000)
    {
        printf("ABC");
    }
    
    else
    {
        printf("ABD");
    }
    
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int n,k;
    cin >>  n >> k;
    
    int a[n];
    f(i,n) cin >> a[i];
    
    sort(a,a+n);
    
    int res = 0;
    
    f(i,k) res+=a[i];
    cout << res;
    
    
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Measured memory_bytes: 3652
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, K = LI()

    ans = 1
    for i in range(N):
        if i == 0:
            ans *= K
        else:
            ans *= (K - 1)

    print(ans)

if __name__ == '__main__':
    resolve()


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

using namespace std;

const int N = 200 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n;
long long A, B;
long long t[N], sum01[N], sum11[N];
long long dp[N][2][2];

bool read() {
    if (!(cin >> n >> A >> B))
        return false;

    for (int i = 1; i <= n; ++i)
        cin >> t[i];

    return true;
}

long long getsum01(int l, int r) { return r < 0 || l > r ? 0ll : sum01[r] - sum01[max(0, l - 1)]; }
long long getsum11(int l, int r) { return r < 0 || l > r ? 0ll : sum11[r] - sum11[max(0, l - 1)]; }

void solve() {
    if (A > B)
        swap(A, B);

    dp[1][0][0] = 1;
    dp[1][0][1] = 0;
    dp[1][1][0] = 1;
    dp[1][1][1] = 0;
    t[0] = t[1];
    auto l = 1;
    auto r = 0;

    for (int i = 2; i <= n; ++i) {
        dp[i][0][0] = dp[i - 1][1][1];

        if (t[i] - t[i - 1] >= A)
            dp[i][0][0] += dp[i - 1][0][0] + dp[i - 1][0][1];

        dp[i][0][0] %= MOD;

        if (i == 2 || t[i] - t[i - 2] >= A)
            dp[i][0][1] = dp[i - 1][1][0];

        for (; r + 1 <= i && t[i] - t[r + 1] >= B; ++r) { }

        if (t[i - 1] - t[i - 2] < A)
            l = i - 1;

        dp[i][1][0] = (l == 1 ? 1 : 0) + getsum01(l, min(i - 1, r + 1)) + getsum11(l - 1, min(r, i - 2));
        dp[i][1][0] %= MOD;

        if (t[i] - t[i - 1] >= B)
            dp[i][1][1] = dp[i - 1][1][0] + dp[i - 1][1][1];

        dp[i][1][1] %= MOD;
        sum01[i] = (sum01[i - 1] + dp[i][0][1]) % MOD;
        sum11[i] = (sum11[i - 1] + dp[i][1][1]) % MOD;
    }

    auto ans = dp[n][0][0] + dp[n][0][1] + dp[n][1][0] + dp[n][1][1];
    cout << (MOD + ans % MOD) % MOD << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 8448
package main

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

var sc *bufio.Scanner
var out *bufio.Writer

func main() {
	sc = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
	buf := make([]byte, 1<<20)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	n, k := nextInt(), nextInt()
	a := nextInts(n)

	low, high := 0, int(1e9+1)
	for high-low > 1 {
		middle := low + (high-low)/2
		divNum := 0
		for i := 0; i < n; i++ {
			if a[i]%middle == 0 {
				divNum += a[i]/middle - 1
			} else {
				divNum += a[i] / middle
			}
		}
		if divNum > k {
			low = middle
		} else {
			high = middle
		}
	}

	fmt.Fprintln(out, high)
}

func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}
func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}


Measured memory_bytes: 6264
sin = list(input())

gu = list()
ki = list()
for i, s in enumerate(sin):
    if i % 2 == 0:
        ki.append(s)
    else:
        gu.append(s)

if set(ki) <= set(['R', 'U', 'D']):
    if set(gu) <= {'L', 'U', 'D'}:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 3060
from collections import deque

N = input()
digit = len(N)
f_digit = int(N[0])
l_digit = int(N[-1])
N = int(N)
cnt = 0

g_cnt = [[0]*10 for _ in range(10)]

for i in range(1, 10):
    for j in range(1, 10):
        g_cnt[i][j] = 0
        if i == j:
            if i <= N:
                g_cnt[i][j] += 1
            if i*10+i <= N:
                g_cnt[i][j] += 1
        else:
            if i*10+j <= N:
                g_cnt[i][j] += 1

        if digit >= 3:
            num = deque([str(k) for k in range(10)])
            while num:
                q = num.popleft()
                for k in range(10):
                    if int(str(i)+q+str(k)+str(j)) <= N:
                        num.append(q+str(k))
                if int(str(i)+q+str(j)) <= N:
                    g_cnt[i][j] += 1

for i in range(1, 10):
    for j in range(i, 10):
        if i == j:
            cnt += g_cnt[i][j] ** 2
        else:
            cnt += g_cnt[i][j] * g_cnt[j][i] * 2

print(cnt)

Measured memory_bytes: 78708
#include <iostream>
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

int main(){
    int ans=0;
    string S,T;
    cin>>S>>T;
    for(int i=0;i<3;i++){
        if(S[i]==T[i])ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
		int n,t[100],m,px[100][2],sum=0,i;
		scanf("%d",&n);
		for(i=0;i<n;i++){
				scanf("%d",&t[i]);
				sum+=t[i];
		}
		scanf("%d",&m);
		for(i=0;i<m;i++){
				scanf("%d%d",&px[i][0],&px[i][1]);
				printf("%d\n",sum+px[i][1]-t[px[i][0]-1]);
		}
		return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

	ll n;cin >> n;
	ll ans = 0;
	for(ll i = 2;i * i <= n;i++){
		int cou = 0;
		while(n % i == 0){
			n /= i;
			cou++;
		}

		int tmp = 1;
		while(tmp <= cou){
			ans++;
			cou -= tmp;
			tmp++;
		}
	}

	if(n > 1)ans++;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main () {
	int n;
	cin >> n;
	for (int i = 0; i <= 50000; i++) {
		if ((int)((double)i * 1.08) == n) {
			cout << i << endl;
			return 0;
		}
	}
	puts(":(");
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val list: MutableList<Int> = mutableListOf()
    for (i in 1..5) {
        list.add(sc.nextInt())
    }
    for (i in 0..4){
        if(list.get(i) ==0){
            print(i+1)
        }
    }
}

Measured memory_bytes: 36228