akhauriyash/Code-Regression huggingface dataset:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools
import heapq
#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    n=list(input())
    a=n[-1]
    if a=="2" or a=="4" or a=="5" or a=="7" or a=="9":
        print("hon")
    elif a=="3":
        print("bon")
    else:
        print("pon")



if __name__ == "__main__":

    main()

Measured memory_bytes: 9712
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

typedef struct {
	int from, to, cost;
} edge;

int Update(vector<int>& ans, vector<edge>& d) {
	int i, update = 0;
	rep(i, d.size()) {
		edge& e = d[i];
		if (ans[e.from] != -INF && ans[e.to] < ans[e.from] + e.cost) {
			update = 1;
			ans[e.to] = ans[e.from] + e.cost;
		}
	}
	return update;
}

void DFS(int n, vector<list<int>>& d, vector<int>& ng) {
	ng[n] = 0;
	for (auto it = d[n].begin(); it != d[n].end(); it++) {
		if (ng[*it])
			DFS(*it, d, ng);
	}
	return;
}

void Erase(vector<edge>& d, vector<int>& ng) {
	for (int i = d.size() - 1; i >= 0; i--) {
		if (ng[d[i].from] || ng[d[i].to])
			d.erase(d.begin() + i);
	}
	return;
}

void Optim(int num, vector<edge> &d) {
	int i;
	vector<list<int>> a(num + 1), b(num + 1);
	rep(i, d.size()) {
		edge& e = d[i];
		a[e.from].push_back(e.to);
		b[e.to].push_back(e.from);
	}
	vector<int> ng(num + 1, 1);
	DFS(1, a, ng);
	Erase(d, ng);
	fill(ng.begin(), ng.end(), 1);
	DFS(num, b, ng);
	Erase(d, ng);
}

int main(void) {
	int num, m, i, p;
	cin >> num >> m >> p;
	vector<int> ans(num + 1, -INF);
	vector<edge> d(m);
	rep(i, m) {
		cin >> d[i].from >> d[i].to >> d[i].cost;
		d[i].cost -= p;
	}
	ans[1] = 0;
	Optim(num, d);
	rep(i, num)
		Update(ans, d);
	if (Update(ans, d))
		printf("-1\n");
	else if (ans[num] <= 0)
		printf("0\n");
	else
		cout << ans[num] << "\n";
	return 0;
}

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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int d;
  cin >> d;
  
  vector<int> c(26);
  for (int i = 0; i < 26; i++) cin >> c.at(i);
  
  vector<vector<ll>> s(d, vector<ll>(26));
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s.at(i).at(j);
    }
  }
  
  vector<int> t(d);
  for (int i = 0; i < d; i++) {
    cin >> t.at(i);
    t.at(i)--;
  }
  
  vector<vector<int>> dim(d, vector<int>(26, 1));
  ll suff = 0;
  for (int i = 0; i < d; i++) {
    suff += s.at(i).at(t.at(i));
    if (i > 0) {
      for (int j = 0; j < 26; j++) dim.at(i).at(j) = dim.at(i - 1).at(j) + 1;
    }
    dim.at(i).at(t.at(i)) = 0;
    for (int j = 0; j < 26; j++) {
      suff -= c.at(j) * dim.at(i).at(j);
    }
    cout << suff << '\n';
  }
}

Measured memory_bytes: 3760
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
L = [[int(v) for v in input().split()] for _ in range(N)]

m = {}
for i in range(N):
    for j in range(N):
        if i != j:
            x, y = L[i]
            x2, y2 = L[j]

            key = (x - x2, y - y2)

            if m.get(key) == None:
                m[key] = 0
            m[key] += 1

if m == {}:
    print(1)
    exit()
print(N - max(m.values()))

Measured memory_bytes: 3828
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
vector<T> gen_v(size_t a) {
    return vector<T>(a);
}
template <typename T, typename... Ts>
auto gen_v(size_t a, Ts... ts) {
    return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) {
    for (auto& e : t) fill_v(e, v);
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int M, D;
    cin >> M >> D;
    int cnt = 0;
    rep(m, 1, M + 1) {
        rep(d, 1, D + 1) {
            if (d >= 20 && (d % 10) >= 2 && (d / 10) * (d % 10) == m) { cnt++; }
        }
    }
    cout << cnt << endl;
    return 0;
}


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

void inline output(int res){
	int h=res/3600;
	int m=(res/60)%60;
	int s=res%60;
	printf("%02d:%02d:%02d\n",h,m,s);
}

int main(void){
	int h,m,s;
	while(cin >> h >> m >> s){
		if(h==-1) break;
		int sum=3600*h+60*m+s;
		int res=3600*2-sum;
		output(res);
		output(res*3);
	}
	return 0;
}

Measured memory_bytes: 1144
#include <iostream>
#include <sstream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <iomanip>
#include <string>
using namespace std;

//関数getinputdata宣言
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();

void abc118_a(vector<vector<int>> v) {

    int a = v[0][0];
    int b = v[0][1];
    
    
    cout <<( b % a==0 ? a+b :b-a) << endl;
  


}

int main() {

//    vector<vector < string>> vec_arr_result;
                    vector<vector<int>> vec_arr_result;
    vec_arr_result = getinputdata2();

    abc118_a(vec_arr_result);

    return 0;
}

//関数getinputdata実装
vector<vector<double>> getinputdata3() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<double>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<double> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atof(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;
}

//関数getinputdata実装

vector<vector<int>> getinputdata2() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<int>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<int> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atoi(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;


}

//関数getinputdata実装

vector<vector < string >> getinputdata() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector < string>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<string> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(ret);
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

int main(void)
{
	int n;
	while(scanf("%d", &n)==1)
	{
		vi a(n), b(n);

		for(int i=0;i<n;i++) scanf("%d%d", &a[i], &b[i]);
		sort(a.begin(), a.end());
		sort(b.begin(), b.end());

		int ans=-1;
		if(n&1)
		{
			ans=b[n/2]-a[n/2]+1;
		}
		else
		{
			ans=b[n/2]-a[n/2]+b[n/2-1]-a[n/2-1]+1;
		}
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 4344
#include <iostream>
#include <string>

using namespace std;
int main(void){
    std::string s;
    cin >> s;
    int n = s.size();
    
    std::string s1 = s.substr(0, (n-1)/2);
    std::string s2 = s.substr((n+3)/2-1, n-1);
    //cout << s1 << ":" << s2 << endl;

    for(int i=0; i<s1.size()/2; i++){
        if(s1[i] != s[s1.size()-1-i]){
            cout << "No" << endl;
            return 0;
        } 
    }
    if(s1 != s2){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    //cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define int long long int
#define mod 1000000007
void fast(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int ans=0;
	for(int i=0;i<n;){
		ans++;
		char c=s[i];
		while(i<n&&s[i]==c)i++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int n,d;
int get(vector<int>a, vector<int>b){
	int res = 0;
	for(int i = 0; i < d; i++){
		res += ((a[i] - b[i])* (a[i] - b[i]));
	}

	if((int)sqrt(res) * (int)sqrt(res) == res){
		//cout << res << " ";
		return 1;
	}
	else return 0;
}

int32_t main(){
	fastio();
	
	cin >> n >>d;
	vector<vector<int>>v;
	for(int i = 0; i < n; i++){
		vector<int>a;
		for(int j = 0; j < d; j++){
			int x;
			cin >> x;
			a.push_back(x);
		}
		v.push_back(a);
	}
	int ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			ans += get(v[i],v[j]);
		}
	}

	cout << ans;
}

Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x,n;
  cin>>x>>n;
  map<int,int>m;
  for(int i=0;i<n;i++)
  {
    int t;
    cin>>t;
    m[t]=1;
  }
  int l;
  for(int i=x;i>=0;i--)
  {
    if(m[i]!=1)
    {
      l=i;
      break;
    }
  }
  for(int i=x;i<=101;i++)
  {
    if(m[i]!=1 && abs(l-x)>abs(i-x))
    {
      l=i;
      break;
    }
  }
  cout<<l<<endl;
  return 0;
}
  

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}
void comb(vector<vector<long long int>> &v)
{
	for (int i = 0; i < v.size(); i++)
	{
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++)
	{
		for (int j = 1; j < k; j++)
		{
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}
bool is_not_out_of_range(size_t now, size_t max_num)
{
	return !(now < 0 || max_num <= now);
}
ll repeat_squaring(ll n, ll p, ll m)
{
	if (p == 0)
		return 1;
	if (p % 2 == 0)
	{
		ll t = repeat_squaring(n, p / 2, m);
		return t * t % m;
	}
	return n * repeat_squaring(n, p - 1, m);
}

int main()
{
	int h, w;
	cin >> h >> w;
	vector<str> v(h);
	rep(i, h)
	{
		cin >> v[i];
	}
	rep(i, h)
	{
		cout << v[i] << endl;
		cout << v[i] << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    long long ans = 0;
    for (int bit = 0; bit < 1 << (n - 1); ++bit) {
        int last = 0;
        for(int j = 0; j <= n; ++j) {
            if ((bit >> j) & 1 || j == n) {
                ans += stol(s.substr(last, j - last + 1));
                last = j + 1;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <deque>
#include <list>
#include <set>
#include <random>

using namespace std;
using ll = long long;
const int BIG = 100000007;



int main(){
    int a,b;
    cin >> a >> b;
    cout << (a * b) << endl;
}


Measured memory_bytes: 3188
n = int(input())

data = [list(map(int, input().split())) for _ in range(n)]
result = [0] * n
flag = 1

for i in range(n):
    if data[i][2] != 0:
        start = i
        break
for i in range(100 + 1):
    for j in range(100 + 1):
        flag = 1
        h = data[start][2] + abs(data[start][0] - i) + abs(data[start][1] - j)
        for k in range(n):
            if data[k][2] != max(h - abs(data[k][0] - i) - abs(data[k][1] - j), 0):
                flag = 0
                break
        if flag == 1:
            print("{0} {1} {2}".format(i, j, h))
            exit()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < n; i++)
#define REPR(i,n) for(int i = n; i >= 0; i--)
#define FOR(i,m, n) for(int i = m-1; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
//vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2, 初期値))
//vector<intなど> 変数名(要素数,初期値)
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin>>n;
    vector<int> h(3);
    vector<vector<int>> dp(3, vector<int>(n+1));
    REP(i,3) dp[i][0]=0;
    REP(i,n){
        REP(j,3) cin>>h[j];
        REP(j,3){
            REP(k,3) {
                if(j!=k) {
                  dp[j][i+1]=max(dp[j][i+1],dp[k][i]+h[k]);
                //cout<<"k="<<k<<"|"<<"dp["<<j<<"]["<<i+1<<"]="<<dp[j][i+1]<<endl;
                }
            }
    
            
        }
    }
    int ans=0;
    REP(i,3) ans=max(ans,dp[i][n]);
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;

int main() {
  int n,x;
  cin >> n >> x;
  int j = n;
  int m[n];
  const int count = n;
  for (size_t i = 0; i < count; i++) {
    cin >> m[i];
  }
  for (size_t i = 0; i < count; i++) {
    x-=m[i];
  }
  SORT(m, n);
  while (x>=0) {
    x-=m[0];
    j++;
  }
  cout << j-1 << endl;
}


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

using namespace std;
#define REPP(i,a,b,c) for(int i=a; i<=b; i+=c)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,c) for(int i=a; i>=b; i-=c)
#define REV(i,a,b) REVV(i,a,b,1)
#define FOR(i,a) REP(i,0,(int)a-1)
#define FORD(i,a) REV(i,(int)a-1,0)
#define PB push_back
#define POB pop_back
#define FI first
#define SE second
#define MP make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef vector < int > vi;
typedef vector < pii > vii;
typedef vector < ll > vl;
typedef pair < ll , ll > pll;

const double PI = acos(-1);
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;
const int INF = 1e9;
	

ll addMod(ll a, ll b){
	if(a + b >= MOD) return a + b - MOD;
	return a + b;
}

ll mulMod(ll a, ll b){
	return (a*b)%MOD;
}

ll fast(ll a, ll b){
	if(b == 0) return 1;
	ll tmp = fast(a,b/2);
	tmp = mulMod(tmp,tmp);
	if(b%2 == 1) tmp = mulMod(tmp,a);
	return tmp;
}

ll GCD(ll a, ll b){
	if(a > b) return GCD(b,a);
	if(a == 0) return b;
	return GCD(b%a,a);
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

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

int n;
string str;

int solve(){
	int ret = n;
	FOR(i,n-1){
		if(str[i] == str[i+1]) ret--;
	}
	return ret;
}

int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> str;
	cout << solve() << endl;
	return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <unordered_map>
#include <vector>

using namespace std;

const int maxn = 1e6 + 5;
int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
int nums[maxn];
unordered_map<int, int> seen;

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

int main() {
    int n; cin>>n;
    for(int i = 0; i < n; i++){
        cin>>nums[i];
    }
    bool pairco = 1;
    for(int i = 0; i < n; i++){
        int num = nums[i];
        for(int j = 0; j < 168; j++){
            if(num == 1) break;
            int see = 0;
            while(num % primes[j] == 0){
                if(!see && seen[primes[j]]){
                    pairco = 0;
                    break;
                }
                num /= primes[j];
                seen[primes[j]] = 1;
                see = 1;
            }
        }
        if(num != 1 && seen[num]){
            pairco = 0;
            break;
        }
        seen[num] = 1;
    }
    if(pairco){
        cout<<"pairwise coprime"<<endl;
        return 0;
    }
    int _gcd = nums[0];
    for(int i = 1; i < n; i++){
        _gcd = gcd(_gcd, nums[i]);
    }
    if(_gcd == 1){
        cout<<"setwise coprime"<<endl;
        return 0;
    }
    cout<<"not coprime"<<endl;
}


Measured memory_bytes: 7436
// Starting with the name of Allah

#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define Nayon ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
#define v_sum(a)         accumulate(a.begin(),a.end(),0)
#define v_max(a)         *max_element(a.begin(),a.end())
#define v_min(a)         *min_element(a.begin(),a.end())
#define v_uni(a)         a.erase(unique(a.begin(),a.end()),a.end())

using namespace std;




int main()
{
	Nayon;
	double d,t,v;
	cin>>d>>t>>v;
	if(d/v<=t){
		cout<<"Yes"<<nl;
	}
	else{
		cout<<"No"<<nl;
	}
	return 0;
}

//Happy Coding......

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n, l;
  cin >> n >> l;

  vll a(n);
  REP(i, n)
    cin >> a[i];

  bool flag = false;
  ll last = 0;
  REP1(i, n){
    if(a[i]+a[i-1] >= l){
      flag = true;
      last = i-1;
    }
  }

  if(flag){
    cout << "Possible" << endl;
    for(ll i = 0; i<last; i++)
      cout << i+1 << endl;
    for(ll i = n-1-1; i>last; i--)
      cout << i+1 << endl;

    cout << last+1 << endl;
  }
  else
    cout << "Impossible" << endl;
}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N;
    cin >> N;
    vector<lint> A(N, 0);
    rep(i, N) cin >> A[i];

    vector<lint> L(N + 1, 0);
    rep(i, N) L[i + 1] = L[i] + A[i];

    // dump(A);
    // dump(L);

    map<lint, lint> mp;
    for (int i = 0; i <= N; i++) {
        mp[L[i]]++;
    }

    lint cnt = 0;
    for (auto p : mp) {
        lint x, c;
        tie(x, c) = p;
        dd(x, c);
        cnt += c * (c - 1) / 2;
    }

    cout << cnt << endl;
    return 0;
}

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

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

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

    int N;
    cin >> N;

    int ans = 0;
    int a;
    rep(i, N) {
        cin >> a;
        ans += a - 1;
    }

    cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using LL=int64_t;
const int INF=0x3f3f3f3f;
const int maxn=1e6+5;
int sum[maxn];
bool prime[1010000];//prime是true的是素数
int ans[1000000];//ans从1开始是素数
void init_prim()
{
    memset(ans, 0, sizeof(ans));
    memset(prime, true, sizeof(prime));
    int num = 0;
    for (int i = 2; i <= maxn; ++i)
    {
        if (prime[i] == true)
        {
            num++;
            ans[num] = i;
        }
        for (int j = 1; ((j <= num) && (i * ans[j] <= maxn));  ++j)
        {
            prime[i * ans[j]] = false;
            if (i % ans[j] == 0) break; //µã¾¦Ö®±Ê
        }
    }
    prime[0]=prime[1]=false;
}

void init() {
    init_prim();
    memset(sum,0,sizeof(sum));
    for(int i=1;i<maxn;i++) {
        if(i%2==1&&prime[i]==1&&prime[(i+1)/2]==1) sum[i]=sum[i-1]+1;
        else sum[i]=sum[i-1];
    }
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    init();
    int n,x,y;
    cin>>n;
    for(int i=0;i<n;i++) {
        cin>>x>>y;
        cout<<sum[y+1]-sum[x-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 9472
#include<bits/stdc++.h>
int main(){
    int n;std::cin>>n;
    std::vector<long long>a(n+2);
    for(int i=0;i<n;i++){
        std::cin>>a.at(1+i);
    }
    std::vector<int>ord(n);
    std::iota(ord.begin(),ord.end(),1);
    std::sort(ord.begin(),ord.end(),[&a](int x,int y){return a.at(x)>a.at(y);});

    int N=1;while(N<n+2)N<<=1;
    std::vector<int>table(2*N);
    table.at(N+0)=2;
    table.at(N+1+n)=2;
    for(int i=N-1;i>0;i--)table.at(i)=table.at(2*i)+table.at(2*i+1);
    auto lower_bound=[&](int x){
        int now=0;
        int i=1;
        while(i<N){
            if(now+table.at(2*i)<x){
                now+=table.at(2*i);
                i=2*i+1;
            }else{
                i=2*i;
            }
        }
        return i-N;
    };
    auto query=[&](int l,int r){
        int ans=0;
        for(l+=N,r+=N;l<r;l/=2,r/=2){
            if(l&1)ans+=table.at(l++);
            if(r&1)ans+=table.at(--r);
        }
        return ans;
    };
    long long ans=0;
    for(int i:ord){
        table.at(i+N)++;
        for(int j=(i+N)/2;j>0;j>>=1)table.at(j)=table.at(2*j)+table.at(2*j+1);
        int l0,l1,r0,r1;
        int I=query(0,i+1);
        l0=lower_bound(I-2);
        l1=lower_bound(I-1);
        r0=lower_bound(I+1);
        r1=lower_bound(I+2);
        ans+=a.at(i)*((l1-l0)*(r0-i)+(i-l1)*(r1-r0));
    }
    std::cout<<ans<<std::endl;
}



Measured memory_bytes: 2432
def main():
    N, K = map(int, input().split())
    ans = 0
    for i in range(1, N+1):
        score = i
        count = 0
        while score < K:
            score *= 2
            count += 1
        ans += (1/N) * ((1/2)**count)
    print(ans)


if __name__ == "__main__":
    main()

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

int main(){
  long long N;
  cin >> N;
  vector<long long> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  long long m = A.at(0), ans = 0;
  for(int i = 1; i < N; i++){
    if (m >= A.at(i)){
      ans += m - A.at(i);
    }
    else m = A.at(i);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4840
n = int(input())
xl = [list(map(int,input().split())) for _ in range(n)]
#print(xl)
st = [[x-l, x+l] for x, l in xl] #得られた配列を自分の好きな値のリストに変換
#print(st)
st = sorted(st, key=lambda x: x[1]) #最大値の大きさkeyにすることで重なった箱型の時も防げる
#print(st)
result = 1
#最初は１
p = st[0][1] #keyを比較基準にした
for i in range(1, n):
    if p <= st[i][0]:
        p = st[i][1] #ループの基準を操作する
        result += 1 #カウントもする
print(result)

Measured memory_bytes: 43560
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;

int n;
int ht[100010];
int eg[100010];//eg[i] 代表到达i点消耗的最少能量 
int main(){
	cin>>n;
	for(int i=1;i<=n; ++i){
		cin>>ht[i];
		
	}//读取完毕
	memset(eg, 0, sizeof(eg));
	eg[2] = abs(ht[2]- ht[1]);
	for(int i=3; i<=n; ++i){
		int t1 = abs(ht[i] - ht[i-1]);
		int t2 = abs(ht[i] - ht[i-2]);
		eg[i] = min(eg[i-1]+t1, eg[i-2]+t2); 
	}
	cout<<eg[n]<<endl;
		
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main(){
	int n;
	while(cin >> n, n) {
		int a[110] = {}, cnt = 0;
		rep(i,n) {
			cin >> a[i];
		}
		rep(i,n-1) {
			rep(j,n-i-1) {
				if(a[j] > a[j+1]) {
					swap(a[j],a[j+1]);
					cnt++;
				}
			}
		}
		cout << cnt << endl;
	}
    return 0;
}

Measured memory_bytes: 1164
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => long.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var S = Console.ReadLine();
		var N = S.Length;
		var s = S.Select(c => c - '0').ToArray();
		var bit = new BinaryIndexedTree(s);
		int k = 0, l = 0, r = N;
		while (true)
		{
			var t = bit.Sum(l, r);
			if (t == 0 || t == r - l) break;
			bit.Add(l, -s[l]);
			bit.Add(r - 1, -s[r - 1]);
			l++; r--; k++;
		}
		Console.WriteLine(N - k);
	}
}
class BinaryIndexedTree
{
	public readonly int Size;
	readonly int[] bit;
	public BinaryIndexedTree(int size)
	{
		Size = size;
		bit = new int[size + 1];
	}
	public BinaryIndexedTree(int[] array) : this(array.Length)
	{
		for (var i = 0; i < Size; i++) bit[i + 1] = array[i];
		for (var i = 1; i < Size; i++) if (i + (i & (-i)) <= Size) bit[i + (i & (-i))] += bit[i];
	}
	public void Add(int index, int value) { for (var i = index + 1; i <= Size; i += i & (-i)) bit[i] += value; }
	int Sum(int to) { var sum = 0; for (var i = to; i > 0; i -= i & (-i)) sum += bit[i]; return sum; }
	public int Sum(int from, int to) => Sum(to) - Sum(from);
}


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

struct Test{
  int A[3];
  bool R;
};

Test tests[1000];
int info[301], M[3], N;

int main()
{
  while(true)
  {
    for(int i = 0; i <= 300; i++)
      info[i] = 2;
  
    cin >> M[0] >> M[1] >> M[2];
    if(!(M[0] || M[1] || M[2]))
      break;
    cin >> N;
    for(int i = 1; i <= N; i++)
     cin >> tests[i].A[0] >> tests[i].A[1] >> tests[i].A[2] >> tests[i].R;

    bool b = true;
    while(b)
    {
      b = false;
      for(int i = 1; i <= N; i++)
      {
        if(tests[i].R)
        {
          for(int j = 0; j < 3; j++)
          {
            if(info[tests[i].A[j]] != 1)
            {
              info[tests[i].A[j]] = 1;
              b = true;
            }
          }
        }
        else
        {
          int tmp = 0;
          bool f = false;
          for(int j = 0; j < 3; j++)
          {
            tmp += info[tests[i].A[j]] == 1;
          }
          if(tmp == 2)
          {
            for(int j = 0; j < 3; j++)
            {
              if(info[tests[i].A[j]] == 2)
              {
                info[tests[i].A[j]] = 0;
                b = true;
              }
            }
          }
        }
      }
    }
    for(int i = 1; i <= M[0] + M[1] + M[2]; i++)
    {
       cout << info[i] << endl;
    }
  }
}

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

int gcd(int x, int y);

int main()
{
	int x,y;
	cin >> x;
	cin >> y;

	cout << gcd(x, y) << '\n';
	
	return 0;
}

int gcd(int x, int y)
{
	int r;

	if (x < y)
		swap(x,y);

	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}

	return x;

}


Measured memory_bytes: 3100
from itertools import combinations_with_replacement

n,m,q=map(int,input().split())
abcd=[]
for i in range(q):
    abcd.append(list(map(int,input().split())))

ans=0
for A in combinations_with_replacement(list(range(1,m+1)),n):
#    print(A)
    asum=0
    for a,b,c,d in abcd:
        if A[b-1]-A[a-1]==c:
            asum+=d
    ans=max(ans,asum)
print(ans)
       

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll N, K;
  cin >> N;

  if (N == 1) {
    cout << "Yes" << endl;
    cout << "2" << endl;
    cout << "1 1" << endl;
    cout << "1 1" << endl;
    return 0;
  }

  bool ok = false;
  for (ll k=1; k<=N; k++) {
    if (k*(k-1) == 2*N) {
      ok = true;
      K = k;
    }
  }
  if (!ok) {
    cout << "No" << endl;
    return 0;
  }

  vector<vector<ll>> ans(K);

  ll p = 0;
  for (ll i=0; i<K; i++) {
    for (ll j=i+1; j<K; j++) {
      ans[i].push_back(p);
      ans[j].push_back(p);
      p++;
    }
  }

  cout << "Yes" << endl << K << endl;
  rep(i,K) {
    cout << K-1 << " ";
    rep(j,K-1) {
      cout << ans[i][j]+1 << " ";
    }
    cout << endl;
  }
  return 0;
}


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

using namespace std;

#define int long long
#define rep(i,a,n) for(int i = a; i<n; i++)
#define per(i,a,n) for(int i = n-1; i>=a; i--)

const int INF = 1e9+7;

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  map<string,int> in;
  int n;
  cin>>n;
  while(n--){
    string s;
    cin>>s;
    in[s]++;
  }

  auto k = in.begin();

  vector<pair<int,string> > v;
  while(k != in.end()){v.push_back(make_pair(k->second,k->first));k++;}
  sort(v.rbegin(),v.rend());
  vector<string> ss;
  for(auto i:v){
    if(i.first == v[0].first)ss.push_back(i.second);
  }
  sort(ss.begin(),ss.end());
  for(auto i:ss)cout<<i<<"\n";
}


Measured memory_bytes: 31340
import sys
readline = sys.stdin.readline
read = sys.stdin.read
n,a,b = [int(i) for i in read().split()]

MOD = 10**9+7
ans = pow(2,n,MOD)-1

# 全部の場合から、aとbの場合を引き算する
def choose(n,r):
    res = 1
    fac = 1
    for i in range(r):
        res *= n-i
        res %= MOD
        fac *= i+1
        fac %= MOD
    return res*pow(fac,MOD-2,MOD)%MOD        

ans -= choose(n,a)
ans -= choose(n,b)
print(ans%MOD)

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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

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

    string S;
    cin >> S;

    rep(i, S.size()) {
        S[i] += N;
        if ('Z' < S[i]) S[i] -= 26;
    }

    cout << S << endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = [int(x) for x in input().split()]

ans = 0
for i in range(k):
    ans += (1+a[i])/2
answer = ans
for i in range(k, len(a)):
    ans = ans + (a[i]+1)/2 - (a[i-k]+1)/2
    if ans > answer:
        answer = ans
print(answer)

Measured memory_bytes: 25188
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int dp[101][100001];
int main(){
	int N,W;
	int value[100],weight[100];
	int valuemax=0;
	scan(N);scan(W);
	rep(i,N){
		scan(weight[i]);scan(value[i]);
	}
	rep(i,N){
		rep(v,100001){
			dp[i][v]=INF;
		}
	}
	dp[0][0]=0;
	rep(i,N){
		rep(v,100001){
			dp[i+1][v]=min(dp[i+1][v],dp[i][v]);
			if(v+value[i]<=100000){
				dp[i+1][v+value[i]]=min(dp[i][v+value[i]],dp[i][v]+weight[i]);
				if(dp[i+1][v+value[i]]>W) dp[i+1][v+value[i]]=INF;
				else if(v+value[i]>valuemax) valuemax=v+value[i];
			}
		}
		/*printf("i=%d ",i+1);
		rep(v,20){
			printf("%2d ",dp[i+1][v]);
		}
		kaigyo;
		prin(valuemax);*/
	}
	prin(valuemax);
	return 0;
}


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

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

    int k, n, a[200001];
    cin >> k >> n;
    for(int i=0;i<n;++i){
        cin >> a[i];
    }
    a[n] = a[0] + k;

    int mx = 0;
    for(int i=1;i<=n;++i){
        mx = max(mx, a[i] - a[i-1]);
    }
    cout << k - mx << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long a, b, k;
	cin >> a >> b >> k;
if(k <= a){
 cout << a - k << ' ' << b <<endl;
 }else if(k <= a+b){
 cout << 0 << ' ' << b - (k-a) <<endl;
 }else{
 cout << 0 << ' ' << 0 <<endl;
 }
	
}		




Measured memory_bytes: 3552
#include<iostream>
using namespace std;
int main(){
    int H=1;
    int W=1;
    while (H!=0&&W!=0)
    {
     cin>>W>>H;
     for(int i=0;i<W;i++){
        for(int i=0;i<H;i++){
           cout<<'#';
         }
         cout<<endl;
     } 
     if (H!=0&&W!=0)
     {
        cout <<endl;
     }
     
    }
    return 0;
}


Measured memory_bytes: 3088
N,A,B = map(int,input().split())
if A+B > N+1 or A*B < N:
    print(-1)
    exit()

ls = [1]*B
rem = N-B
i = 0
while rem > 0:
    r = min(A-1, rem)
    ls[i] += r
    rem -= r
    i += 1

bs = [[] for _ in range(B)]
n = 1
for j,l in enumerate(ls):
    for i in range(l):
        bs[j].append(n)
        n += 1
ans = []
for b in reversed(bs):
    ans += b
print(*ans)

Measured memory_bytes: 44804
#include <iostream>
unsigned long long a[100000],b[200000],c,n;
using namespace std;
int main(){
  for(int i=2;i<200000;i++)
    for(int j=i*2;j<200000;j+=i)
      b[j]++;
  for(int i=2;i<200000;i++)if(!b[i]){a[c+1]+=i+a[c];c++;}
  while(cin>>n,n)cout<<a[n]<<endl;
}

Measured memory_bytes: 4776
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ffor(i,n) for(int i = 0;i < (n); ++i)
#define all(v) (v.begin(),v.end())
#define vi vector<int>
int ans = 0;
vi xa = {0,-1,1,0};
vi ya = {1,0,0,-1};
int h,w;
vector<vector<char>> s;
 
 
void dfs(int x,int y){
    vector<vector<bool>> vis(h,vector<bool>(w));
    queue<pair<int,pair<int,int>>> q;
    q.push({0,{x,y}});
    while(!q.empty()){
        x = q.front().second.first;
        y = q.front().second.second;
        int dist = q.front().first;
        vis[x][y] = true;
        q.pop();
        for(int i = 0;i < 4; ++i){
            int nx = x + xa[i];
            int ny = y + ya[i];
            if((nx < h) && (ny < w) && (nx >= 0 && ny >= 0) && (!vis[nx][ny]) && (s[nx][ny] != '#')){
                q.push({dist + 1,{nx,ny}});
				vis[nx][ny] = true;
                ans = max(ans,dist + 1);
            }
        }
    }
}
 
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin >> h >> w;
    s.resize(h,vector<char>(w));
    ffor(i,h){
        ffor(j,w){
            cin >> s[i][j];
        }
    }
 
    for(int i = 0;i < h;++i){
        for(int j = 0;j < w; ++j){
            if(s[i][j] == '#') continue;
            dfs(i,j);
        }
    }
 
    cout << ans;
}

Measured memory_bytes: 892
def gcd(x,y):
    if y>x:
        a=y
        y=x
        x=a
    while y:
        a=x%y
        x=y
        y=a
    return x

a,b=map(int,input().split())
c=list(map(int,input().split()))
c.append(b)
c.sort()
for i in range(a):
    c[-1-i]-=c[-2-i]
b=0
for i in range(a):
    b=gcd(c[i+1],b)
print(b)

Measured memory_bytes: 14252
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

  vector<int> v(5);
  rep(i, 5) cin >> v[i];
  int k; cin >> k;
  if(v[4] - v[0] > k){
    cout << ":(" << endl;
  }
  else{
    cout << "Yay!" << endl;
  }
	return 0;
}


Measured memory_bytes: 256
import math
import sys
S=int(input())
x=[0]*3
y=[0]*3
if S==10**18:
    x[1]=10**9
    y[1]=0
    x[2]=0
    y[2]=10**9
    print(x[0],y[0],x[1],y[1],x[2],y[2])
    sys.exit()
x[1]=10**9
y[2]=S//(10**9)+1
y[1]=x[1]*y[2]-S
x[2]=1
print(x[0],y[0],x[1],y[1],x[2],y[2])

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

using ll = long long;
using boost::irange;

int main(){
    ll N;
    vector<ll> H(N);

    cin >> N;

    ll num_max = 0;
    ll cnt = 0;
    for(auto &h: H){
        cin >> h;
    }

    for (ll i=0; i<N-1; i++){
        if(H[i] >= H[i+1]){
            cnt++;
        }
        else{
            if (num_max < cnt) num_max = cnt;
            cnt = 0;
        }
    }
    if (num_max < cnt) num_max = cnt;

    cout << num_max << endl;

}

Measured memory_bytes: 33024
from itertools import accumulate

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [0] + list(accumulate(A))
    MOD = 10 ** 9 + 7
    ans = 0
    for i in range(N):
        ans += A[i] * (B[N] - B[i+1])
        ans %= MOD

    print(ans)




if __name__ == "__main__":
    main()

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

int main()
{
  int i,j,k;
  int N;
  
  char S[104];
  char T[104];
  char NEW[1024];

  scanf("%d",&N);
  scanf("%s %s",S,T);
  
  //printf("%s\n",S);
  for(i=0;i<N;i++){
    j = 2*i;
    k = 2*i+1;
    NEW[j] = S[i];
    NEW[k] = T[i];
    NEW[k+1] = '\0';
  }
  
  printf("%s",NEW);
  
  
  
  return 0;
}

Measured memory_bytes: 128
# coding: utf-8
# hello worldと表示する
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
s=SI()
east=[]
west=[]
state=s[0]
count=1
if s[0]=="W":
    east.append(0)
for i in range(1,n):
    if s[i]==state:
        count+=1
    else:
        if state=="W":
            west.append(count)
            count=1
            state="E"
        else:
            east.append(count)
            count=1
            state="W"
if state=="W":
    west.append(count)
else:
    east.append(count)
if s[-1]=="E":
    west.append(0)
#print(east)
#print(west)
x=len(east)
E=sum(east)
W=sum(west)
anse=[]
answ=[]
vale=E-east[0]
for i in range(1,x):
    anse.append(vale)
    vale+=(west[i-1]-east[i])
anse.append(vale)
'''if east[0]==0:
    anse[0]=inf'''
print(min(anse))

Measured memory_bytes: 50140
n,q=map(int,input().split())
s=input()
a=[0]*(n+10)
for i in range(1,n):
    if s[i-1]=="A" and s[i]=="C":
        a[i]=a[i-1]+1
    else:
        a[i]=a[i-1]
for i in range(q):
    l,r=map(int,input().split())
    print(a[r-1]-a[l-1])

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



long ans;                                                         //ans, sum, tmp はlongにしないと桁あふれする 

/*string で読み込んだ数列（のi桁目）を int のように処理したいときは　(S[i] - '0')　のように書くといい*/
/*rec(何番目の文字を処理するか, 桁数（終わりの判定用）, そのパターンでの合計, いちブロックを計算するためのtmp, 扱う数列)*/

void rec(int i, int n, long sum, long tmp, string S){
    if(i == n-1){                                                 //再起のベースケース。
        ans += sum + (S[i] - '0') + tmp * 10;                     //(S[i] - '0') + tmp * 10 はひとかたまりの数字を表す
    }
    else{
        rec(i + 1, n, sum + (S[i] - '0') + tmp * 10, 0, S);       //[i]のところで区切って、sumに足す。tmpは０に。(+入れる)
        rec(i + 1, n, sum, (S[i] - '0') + tmp * 10,  S);          //[i]のところで区切らず、tmpを足し続ける。（+入れない）
    }
}



int main(){
    string S;
    cin >> S;
    int n = S.size();

    rec(0, n, 0, 0, S);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  /* Max is the greatest common divisor of two natural numbers x and y*/
  int Max, x, y, c;
  scanf("%d %d", &x, &y);
  while(1){
    if (x % y  == 0) break;
    c = x%y;
    x = y;
    y = c;
  }
  Max = y;
  printf("%d\n", Max);
  return 0;
}

Measured memory_bytes: 592