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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

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

    vector<ll> A(N);
    for(int i=0;i<N;i++)
    {
        cin >> A.at(i);
    }

    vector<ll> dis(N);
    for(int i=0;i<N;i++) // dis.at(i) := A.at((i+1)%N) - A.at(i)
    {
        dis.at(i) = A.at((i+1)%N) - A.at(i);
        if(dis.at(i)<0)
        {
            dis.at(i) += K;
        }
    }

    cout << K - *max_element(ALL(dis)) << endl;

    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int w, h;
	char c;
	cin>>h>>w>>c;
	char mat[w][h];
	memset(mat,'.',sizeof(mat));
	mat[w/2][h/2] = c;
	mat[0][0] = '+';
	mat[0][h-1] = '+';
	mat[w-1][0] = '+';
	mat[w-1][h-1] = '+';
	for(int i=1;i<h-1;i++)
	{
		mat[0][i] = '-';
		mat[w-1][i] = '-';
	}
	for(int i=1;i<w-1;i++)
	{
		mat[i][0] = '|';
		mat[i][h-1] = '|';
	}
	for(int i=0;i<w;i++)
	{
		for(int j=0;j<h;j++)
			cout<<mat[i][j];
			
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3100
n = int(input())
s = input()
cnt = s.count("R") * s.count("G") * s.count("B")
for i in range(n-2):
    for j in range(i+1, n-1):
        if s[i] == s[j]:
            continue
        k = j - i + j
        if k > n-1:
            continue
        if s[i] == s[k] or s[j] == s[k]:
                continue
        cnt -= 1
print(cnt)


Measured memory_bytes: 9092
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>

#define WM 1e5
using namespace std;

bool judge(string S,int a,int b) {
    bool ans = true;

    for (int i = 0; i < (a + b)/2 - a; i++) {
        if (S[a + i] != S[b - i]) {
            ans = false;
            break;
        }
    }
    if (S[a] != S[b])
        ans = false;
    return ans;
}
int main() {
    string S;
    cin >> S;
    int N = S.size();
    bool flag = true;
    
    if (!judge(S, 0, N - 1))
        flag = false;

    if (!judge(S, 0, (N-1)/2-1))
        flag = false;

    if (!judge(S, (N + 3) / 2 - 1, N - 1))
        flag = false;


    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char ch[26]={};
    char str[101];
    int i;
    
    scanf("%100s",str);
    
    for(i=0;str[i]!='\0';i++){
        ch[str[i]-'a']++;
    }
    
    for(i=0;i<26;i++){
        if(ch[i]%2==1){
            printf("No\n");
            return 0;
        }
    }
    
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;

signed main(){
	int n, W;
	scanf("%d %d", &n, &W);
	vector<ll> w(n), v(n);
	for(int i = 0; i < n; i++){
		scanf("%lld %lld", &w[i], &v[i]);
	}
	vector<vector<ll> > dp(n + 1, vector<ll> (W + 1, 0));
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= W; j++){
			dp[i + 1][j] = max(dp[i][j], dp[i + 1][j]);
			if(j - w[i] >= 0) dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
		}
	}
	cout << dp[n][W] << endl;
}

Measured memory_bytes: 83256
#include<stdio.h>
int main(){
	int a=0,b=0,count=0,i=0,j;
  	char s[100000];
	scanf("%s",s);
	while(s[i]!='\0'){
    	i++;
    }
  	for(j=0;s[j]!='\0';j++){
    	if(j%2==0){
        	if(s[j]=='0') a++;
          	else b++;
        }
      	else{
        	if(s[j]=='1') a++;
            else b++;
        }
    }
  	if(a>b) printf("%d",b);
  	else printf("%d",a);
	return 0;
}

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

using namespace std;

int main() {
    string s;
    cin >> s;
    set<char> ss;

    for (char c : s) {
        ss.insert(c);
    }

    if (s.size() == ss.size())
        cout << "yes" << endl;
    else
        cout << "no" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    int d = n % 10; n /= 10;
    int c = n % 10; n /= 10;
    int b = n % 10; n /= 10;
    int a = n % 10; n /= 10;

    for(int i = 0; i < 9; i++){
        int op1 = 1, op2 = 1, op3 = 1;
        int w = i;
        if(w % 2 == 0) op3 = 0;
        w /= 2;
        if(w % 2 == 0) op2 = 0;
        w /= 2;
        if(w % 2 == 0) op1 = 0;
        w /= 2;

        int sum = a;
        char o1, o2, o3;
        if(op1 ==  0) {sum += b; o1 = '+';}
        else {sum -= b;o1 = '-';}
        if(op2 ==  0) {sum += c; o2 = '+';}
        else {sum -= c;o2 = '-';}
        if(op3 ==  0) {sum += d; o3 = '+';}
        else {sum -= d; o3 = '-';}

        if(sum == 7){
            cout << a << o1 << b << o2 << c << o3 << d << "=7" << endl;
            return 0;
        }

    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

	int i,j;

	for(i=1;i<10;i++)
	{
		

		for(j=1;j<10;j++)
		{
			printf("%dx%d=",i,j);
			i*j;
			printf("%d\n",i*j);
		
		}

	}


    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int k, ans;
int main()
{
    scanf("%d", &k);
    for (int i = 1; i <= k; i++)
        for (int j = 1; j <= k; j++)
        {
            int s = __gcd(i, j);
            for (int p = 1; p <= k; p++)
                ans += __gcd(s, p);
        }
    printf("%d\n", ans);
    return 0;
}

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

uint64_t test(char *s, int len);
int main(void) {
    char str[16];
    char *p;
    int i;
    
    p = fgets(str, 16, stdin);

    for(i=0;i<16;i++){
        if(str[i] < '0' || str[i] > '9')
            break;
    }

    printf("%lu\n", test(str,i));
    
    return 0;
}

uint64_t combination(char *s, int len, int c,int pos, uint64_t sum) {
    int i,j;
    uint64_t ret=0;
    char buf[16] = {0};
    uint64_t prefix,suffix;
    if(c==1) {
        for(i=pos;i<len;i++) {
            snprintf(buf,i-pos+2,"%s",&s[pos]);
            prefix = strtoul(buf,0,0);
            suffix = strtoul(&s[i+1],0,0);
//            printf("%d(%lu-%lu) -- end\n", i,prefix,suffix);
            ret += (sum + prefix + suffix);
        }
        return ret;
    } else {
        for(i=pos;i<len-(c-1);i++){
        snprintf(buf,i-pos+2,"%s",&s[pos]);
        prefix=strtoul(buf,0,0);
//        printf("%d(%lu) ", i, prefix);
        ret += combination(s, len, c -1, i+1, prefix+sum);
        }
    }

    return ret;
}
uint64_t test(char *s, int len) {
    uint64_t ret;
    uint64_t i;
    char *p=s;

    ret = strtoul(s,0,0);
    len--;
    for(i=1;i<=len;i++){
//        printf("###choose %lu/%d###\n", i,len);
        ret += combination(s,len,i,0,0);
    }

    return ret;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

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

int main(){
  char a[8][8],b[8][8];

  rep(i,8){
    rep(j,8){
      cin >> a[i][j];
    }
  }

  rep(k,3){
    cout << (k+1)*90 << endl;
    rep(i,8){
      rep(j,8){
	cout << a[7-j][i];
	b[i][j] = a[7-j][i];
      }
      cout << endl;
    }
    
    rep(i,8){
      rep(j,8){
	a[i][j] = b[i][j];
      }
    }
  }

  return 0;
}

Measured memory_bytes: 1140
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

struct Combination
{
	vector<ll> fact, inv, invFact;
	int MAX_FACT;
	ll MOD;
	Combination(int n, ll mod) : fact(n + 1), inv(n + 1), invFact(n + 1)
	{
		MAX_FACT = n + 1;
		MOD = mod;
		fact[0] = 1;
		fact[1] = 1;
		invFact[0] = 1;
		invFact[1] = 1;
		inv[1] = 1;
		for (auto i = 2; i < MAX_FACT; ++i)
		{
			fact[i] = fact[i - 1] * i % MOD;
			inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
			invFact[i] = invFact[i - 1] * inv[i] % MOD;
		}
	}

	unsigned long long calcCombination(int n, int k)
	{
		if (n < k)
		{
			return 0;
		}
		if ((n < 0) || (k < 0))
		{
			return 0;
		}

		return fact[n] * (invFact[k] * invFact[n - k] % MOD) % MOD;
	}
};


void primeFactorization(ll n, map<ll, int>& result)
{
	for (auto i = 2ll; i * i <= n; ++i)
	{
		while (n % i == 0)
		{
			++result[i];
			n /= i;
		}
	}

	if (n != 1)
	{
		result[n] = 1;
	}
}

int main()
{
	int N;
	ll M;
	cin >> N >> M;
	
	map<ll, int> m;
	primeFactorization(M, m);

	auto mod = (ll)1e9 + 7;

	Combination c(N + 40, mod);
	auto ans = 1ll;
	for (auto& p : m)
	{
		ans = ans * c.calcCombination(p.second + N - 1, N - 1) % mod;
	}
	cout << ans << endl;

	return 0;
}

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL,LL> PLL;
typedef map<int,int> MII;
typedef queue<int> QI;
typedef queue<PII> QPII;
typedef stack<int> SI;
typedef stack<PII> SPII;
typedef deque<int> DI;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef vector<PII> VPII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define PF push_front
#define POB pop_back()
#define POF pop_front()
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REPR(i,n) RFOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = INT_MAX;
const LL LINF = LLONG_MAX;
const LL MOD = 1e9+7;
const LL MODD = 998244353;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

VI dx = {1,0,-1,0,1,1,-1,-1};
VI dy = {0,1,0,-1,1,-1,1,-1};

LL Gcd(LL a, LL b) {
  return __gcd(a,b);
}

LL Lcm(LL a, LL b) {
  LL abd = Gcd(a,b);
  LL x = a / abd, y = b / abd;
  
  return x*y*abd;
}


LL RepSqu(LL N, LL P, LL M) {
  if(N == 0) {
    return 0;
  }
  
  if(P == 0) {
    return 1;
  }
  if(P%2 == 0) {
    LL t = RepSqu(N, P/2, M);
    return t*t % M;
  }
  return (N * RepSqu(N, P-1, M)) % M;
}


int main() {
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N;
  cin >> N;
  VLL A(N,0), B(N,0);
  VLL C(N,0),D(N,0);
  LL ans = 0;
  REP(i,N){
    cin >> A.at(i);
    A.at(i)--;
    B.at(A.at(i))++;
  }
  
  REP(i,N){
    if(B.at(i)==0){
      continue;
    }
    C.at(i) = B.at(i)*(B.at(i)-1)/2;
    ans += C.at(i);
    if(B.at(i)>1){
      D.at(i) = (B.at(i)-1)*(B.at(i)-2)/2;
    }
  }
  
  REP(i,N){
    cout << ans-C.at(A.at(i))+D.at(A.at(i)) << endl;
  }
  
  return 0;
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */
int main(){
    lint n, k; cin >> n >> k;
    
    vector<lint> vn, vp;
    lint p = 0, q = 0;
    rep(i, n){
        lint x; cin>>x;
        if(x < 0){
            p++; vn.push_back(-x);
        }
        else if(x > 0){
            q++; vp.push_back(x);
        }
    }
    lint r = n - p - q;
    sort(all(vn)); sort(all(vp));

    if(k <= p * q){
        k = p * q - k + 1;
        lint l = 0;
        lint r = vn[p-1] * vp[q-1];
        while(r - l > 1){
            lint m = (l + r) / 2;
            lint cnt = 0;
            rep(i, p){
                auto itr = upper_bound(all(vp), m / vn[i]);
                cnt += (itr - vp.begin());
            }
            if(cnt < k) l = m;
            else r = m;
        }
        out(-r); return 0;
    }
    else if(k <= p*q + r*(p+q) + r*(r-1)/2) {
        out(0); return 0;
    }
    else{
        k -= p*q + r*(p+q) + r*(r-1)/2;

        lint l = 0, r;
        if(p > 0) r = vn[p-1] * vn[p-1];
        else r = 0;
        if(q > 0) r = max(r, vp[q-1]*vp[q-1]);

        while(r - l > 1){
            lint m = (l + r) / 2;
            lint cnt = 0;
            rep(i, p){
                auto itr = upper_bound(all(vn), m / vn[i]);
                lint tmp = itr - vn.begin();
                if(tmp <= i + 1) tmp = 0; else tmp -= (i+1);
                cnt += tmp;
            }
            rep(i, q){
                auto itr = upper_bound(all(vp), m / vp[i]);
                lint tmp = itr - vp.begin();
                if(tmp <= i + 1) tmp = 0; else tmp -= (i+1);
                cnt += tmp;
            }
            if(cnt < k) l = m;
            else r = m;
        }
        out(r); return 0;
    }

}


Measured memory_bytes: 2420
#include<stdio.h>
#include<string.h>
#include<math.h>
char S[105];
int res,n;
 
int dfs(int p,int q)
{
	if(S[p+(S[p]=='n'?5:4)]==0)
	{
		n=q;
		return (S[p]=='n'?0:90*n);
	}
	return dfs(p+(S[p]=='n'?5:4),q*2)+(S[p]=='n'?-1:1)*90*q;
}
 
int main()
{
	for(;gets(S),S[0]!='#';memset(S,0,sizeof(S)))
	{
		res=dfs(0,1);
		for(;n>1&&!(res%2);res/=2,n/=2);
		printf("%d",res);
		if(n>1)printf("/%d",n);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main(){
    ll n,m,sum=0;
    cin>>n>>m;
    
    vll h(n);
    vll ans(n);
    rep(i,n)ans.at(i)=1;
    rep(i,n)cin>>h.at(i);
    ll a,b;
    rep(i,m){
        cin>>a>>b;
       if(h.at(a-1)<h.at(b-1))ans.at(a-1)=0;
       else if(h.at(a-1)==h.at(b-1)){
           ans.at(a-1)=0;
           ans.at(b-1)=0;
       }else ans.at(b-1)=0;
        
    }
    rep(i,n)sum+=ans.at(i);
    cout<<sum<<endl;
}
   



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

using namespace std;
int main () {
	int k,n;
	cin>>k;
	cin>>n;
	int ar[n];int i;
	for(i=0;i<n;i++)
	cin>>ar[i];
	int m; m=0;int x1;int x2;int m1;
	for(i=0;i<n;i++)
	{
		if(i==n-1)
		{
			m1=k+ar[0]-ar[n-1];
		}
		else
		m1=ar[i+1]-ar[i];
		m=max(m,m1);
	}
	
	cout<<k-m<<endl;
	
	
	
}


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


int main(){
	
	int N;
	cin>>N;
	
	vector<vector<int>> X(N);
	
	rep(i,N){
		int x,y;
		scanf("%d %d",&x,&y);
		X[i] = {x,y,i};
	}
	
	sort(X.begin(),X.end());
	dsu D(N);
	set<pair<int,int>> S;
	
	rep(i,N){
		if(S.size()>0 && (S.begin()->first)<X[i][1]){
			pair<int,int> Keep = *S.begin();
			S.erase(S.begin());
			while(S.size()>0 && S.begin()->first < X[i][1]){
				D.merge(S.begin()->second,X[i][2]);
				S.erase(S.begin());
			}
			D.merge(Keep.second,X[i][2]);
			S.insert(Keep);
		}
		else{
			S.insert(make_pair(X[i][1],X[i][2]));
		}
	}
	
	rep(i,N){
		cout<<D.size(i)<<endl;
	}
	
	return 0;
}
 

Measured memory_bytes: 16556
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define EPS 0.0000000001
#define INF 1000000000
#define MOD 1000000007
typedef long long ll;

int h, w;
char s[55][55];

bool fun(int i, int j)
{
    if (s[i][j] == '.')
    {
        return false;
    }
    else
    {
        int x = 0;

        if (i - 1 >= 0)
        {
            if (s[i - 1][j] == '.')
            {
                x++;
            }
        }
        else
        {
            x++;
        }
        if (i + 1 < h)
        {
            if (s[i + 1][j]=='.')
            {
                x++;
            }
        }
        else
        {
            x++;
        }
        if (j - 1 >= 0)
        {
            if (s[i][j - 1] == '.')
            {
                x++;
            }
        }
        else
        {
            x++;
        }
        if (j + 1 < w)
        {
            if (s[i][j + 1] == '.')
            {
                x++;
            }
        }
        else
        {
            x++;
        }

        if(x==4){
            //cout<<i<<j<<endl;
            return true;
        }
        else{
            return false;
        }
    }
}

int main()
{
    cin >> h >> w;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> s[i][j];
        }
    }
    ll count = 0;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if (fun(i, j))
            {
                count++;
            }
        }
    }

    if(count==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
        //cout<<count<<endl;
    }
}

Measured memory_bytes: 256
package main

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

/*
数直線上に2000001個の石が置かれています。これらの石の座標は−1000000,−999999,−999998,…,999999,1000000です。
これらの石のうち、ある連続するK個の石が黒で塗られており、それ以外の石は白で塗られています。
また、座標Xにある石は黒で塗られていることが分かっています。
黒で塗られている石が置かれている可能性のある座標をすべて、小さい順に出力してください。

inputs format: K X
inputs: 3 7
outputs: 5 6 7 8 9
黒で塗られた石の数が3個であることと、座標7の石が黒で塗られていることが分かっています。
このとき、次の3通りの可能性が考えられます。
- 黒で塗られた3個の石は座標5,6,7に置かれている。
- 黒で塗られた3個の石は座標6,7,8に置かれている。
- 黒で塗られた3個の石は座標7,8,9に置かれている。
よって、黒で塗られている石が置かれている可能性のある座標は5,6,7,8,9の5つです。
*/

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	k, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	x, _ := strconv.Atoi(sc.Text())

	start := x - k + 1
	end := x + k - 1

	for i := start; i <= end; i++ {
		fmt.Printf("%d ", i)
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int d, c[26][2];
    
    cin >> d;
    for(int i = 0;i < 26;i++){
        cin >> c[i][0];
        c[i][1] = 1;
    }
    
    int s[d][26], d_max[d][2];
    for(int i = 0;i < d;i++){
        for(int j = 0;j < 26;j++){
            cin >> s[i][j];
        }
    }
    
    for(int i = 0;i < d;i++){
        d_max[i][0] = INT_MIN;
        for(int j = 0;j < 26;j++){
            if(d_max[i][0] < s[i][j] / c[j][1] - d * c[j][0]){
                d_max[i][0] = s[i][j] / c[j][1] - d * c[j][0];
                d_max[i][1] = j;
            }
        }
        cout << d_max[i][1] + 1 << '\n';
        c[d_max[i][1]][1]++;
    }
    
    return 0;
}


Measured memory_bytes: 3680
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

vector<int>sums;

int N;double L;
bool check(const double plus) {

	double now = L;
	for (int i = 0; i < 86400; ++i) {
		now = now+plus - sums[i];
		if (now < 0)return false;
		else {
			now = min(L, now);
		}
	}
	double a(now);

	for (int i = 0; i < 86400; ++i) {
		now = now + plus - sums[i];
		if (now < 0)return false;
		else {
			now = min(L, now);
		}
	}
	double b(now);

	if (a > b + 1e-6) {
		return false;
	}
	else {
		return true;
	}
	
}

int main() {
	while (1) {
		sums.clear();
		sums.resize(100000);
cin >> N >> L;
		if (!N)break;
		for (int i = 0; i < N; ++i) {
			int l, r, u; cin >> l >> r >> u;
			for (int i = l; i < r; ++i) {
				sums[i] = u;
			}
		}


		double amin = 0;
		double amax = 1000000;

		while(amin < amax - 1e-7) {
			double amid = (amin + amax) / 2;
			if (check(amid)) {
				amax = amid;
			}
			else {
				amin = amid;
			}
		}
		cout << setprecision(12) << fixed << amin << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3388
#include <stdio.h>

int main(){
	
	int i, j, n, x, y, z, a[200][200];
	
	scanf("%d", &n);
	
	for(i=1; i<=n; i++)
	  for(j=1; j<=n; j++)
	    a[i][j] = 0;
	    
	for(i=1; i<=n; i++){
	  scanf("%d%d", &x, &y);
	  
	  for(j=1; j<=y; j++){
	  	scanf("%d", &z);
	  	a[i][z] = 1;
	  }
	}
	
	for(i=1; i<=n; i++){
		for(j=1; j<=n; j++){
			
			if(j == n)
			printf("%d", a[i][j]);
			else printf("%d ", a[i][j]);
		}
		
		printf("\n");
		
	}
	return 0;
}

Measured memory_bytes: 684
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	stack<int> S1;
	stack<pair<int, int> > S2;
	char c;
	int sum=0;
	int i,j,a;
	for(i=0; cin >> c ;i++)
	{
		if(c=='\\') S1.push(i);
		else if(c=='/' && S1.size()>0)
		{
			j=S1.top();
			S1.pop();
			sum+=i-j;
			a=i-j;
			while(S2.size()>0 && S2.top().first>j)
			{
				a+=S2.top().second;
				S2.pop();
			}
			S2.push(make_pair(j,a));
		}
	}
	
	vector<int> ans;
	while(S2.size()>0)
	{
		ans.push_back(S2.top().second);
		S2.pop();
	}
	reverse(ans.begin(), ans.end());
	cout << sum << endl;
	cout << ans.size();
	for(i=0;i<ans.size();i++)
	{
	   cout << " ";
	   cout << ans[i];
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 3216
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    A, B = map(int, readline().split())

    if A <= 8 and B <= 8:
        print("Yay!")
    else:
        print(":(")


if __name__ == '__main__':
    main()


Measured memory_bytes: 61820
// WARNING: Add compile option "-std=c++11" for C++11 compile.

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;


/*--- Macro ---*/
#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 mp make_pair
#define pb push_back


/*---  Type ---*/
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;


/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// 4-direction
int dy4[] = {0,  1, -1,  0};
int dx4[] = {1,  0,  0, -1};

// 8-direction
int dy8[] = {0,  1,  1,  1,  0, -1, -1, -1};
int dx8[] = {1,  1,  0, -1, -1, -1,  0,  1};

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

int main() {
  int p, q, r;
  cin >> p >> q >> r;

  cout << min(p+q, min(q+r, r+p)) << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        int x = 0;
        String str = "";
        Scanner sc = new Scanner(System.in);
        Check chk = new Check();
        x = sc.nextInt();
        for(int i=1;i<x+1;i++){
            if(chk.check3X(i)){
                str += " " + Integer.toString(i);
            }else if(chk.has3(i)){
                str += " " + Integer.toString(i);
            }
        }
        System.out.println(str);

    }
}

class Check{
    boolean check3X(int a){
        if(a%3==0){
            return true;
        }
        return false;
    }

    boolean has3(int a){
        String str =  Integer.toString(a);
         for(int i=0;i<str.length();i++){
            if(str.charAt(i)=='3'){
                return true;
            }
        }
        return false;
    }
}

Measured memory_bytes: 185428
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <utility>
 
using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;

int main(void) {
    Int n, m;
    cin >> n >> m;
    vector<pair<Int, Int> > v(n);
    for (Int i = 0; i < n; ++i) {
        cin >> v[i].first >> v[i].second;
    }
    sort(v.begin(), v.end());

    Int cost = 0;
    Int drinkNum = m;
    for (Int i = 0; i < n; i++) {
        if (v[i].second <= drinkNum) {
            cost += (v[i].first * v[i].second);
            drinkNum -= v[i].second;
        } else {
            cost += (v[i].first * drinkNum);
            drinkNum = 0;
            break;
        }
    }
    cout << cost << endl;
    return 0;
}



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

using namespace std;

int main() {

    int n, l, r;
    int row, ans;
    cin >> n;

    for(int i = 0; i < n; i++){
        cin >> l;
        cin >> r;
        row = r - l + 1;
        ans += row;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  int ans=n*800;
  cout<<ans-(n/15)*200<<endl;
}


Measured memory_bytes: 256
//#define DEB1 //output check function
//#define DEB2 //same output, input from input.txt

#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <thread>
#include <mutex>
#include <iomanip>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(),(t).end()
#define FILL(a,c) fill(a, a+ sizeof(a)/sizeof(*a),c)
#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)
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define IN(a, x, b) (a<=x && x<b)
#define PB push_back

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL,LL>;
using VI = vector<int>;
using VVI = vector<VI>;


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


#ifdef DEB1
#define DPRINT(x) cout<< #x << "=" << (x) << endl; // print at debug mode
#else
#define DPRINT(x) ;
#endif
#ifdef DEB1
#define DCHECK(x) cout<< "debug check" << #x << endl;
#else
#define DCHECK(x) ;
#endif
 


/*
constant values
*/

//const int dx[] = {1,0,-1,0};
//const int dy[] = {0,1,0,-1};
//const int MX = 31001;

//const ll INF= 1LL<<60 ;//INF = 1001001001001; //1e9

// Main program
void solve(){
    int N;
    int A[51];
    cin >> N;
    REP(i,N) cin >> A[i];
    REP(i,N){
        REP(j,N){

            int tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
            
            //check
            bool flag=0;
            REP(k,N-1){
                DPRINT(A[k])
                if(A[k]>A[k+1]) flag=1;
            }
            if(flag==0){
                cout << "YES" <<endl;
                return;
            }
            tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
        }
    }
    cout << "NO" << endl;

}



// ----------------------------------------------
int main() {

#ifdef DEB2
    cout << "DEBUG MODE"  << endl;
	ifstream in("input.txt"); //for debug
	cin.rdbuf(in.rdbuf()); //for debug
#endif

	int T=1; 

	for (int i = 0; i < T; ++i) {
		solve();
	}
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ZYCSwing
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();

            int[] nums = new int[4];
            for (int i = 0; i < 4; ++i) {
                nums[i] = s.charAt(i) - '0';
            }

            for (int i = 0; i < 2; ++i) {
                int tmp = nums[0];
                StringBuffer sb = new StringBuffer();
                sb.append("" + nums[0]);
                if (i == 0) {
                    tmp += nums[1];
                    sb.append("+");
                } else {
                    tmp -= nums[1];
                    sb.append("-");
                }
                sb.append("" + nums[1]);
                for (int j = 0; j < 2; ++j) {
                    if (j == 0) {
                        tmp += nums[2];
                        sb.append("+");
                    } else {
                        tmp -= nums[2];
                        sb.append("-");
                    }
                    sb.append("" + nums[2]);
                    for (int k = 0; k < 2; ++k) {
                        if (k == 0) {
                            tmp += nums[3];
                            sb.append("+");
                        } else {
                            tmp -= nums[3];
                            sb.append("-");
                        }
                        sb.append("" + nums[3]);
                        if (tmp == 7) {
                            out.println(sb.toString() + "=7");
                            return;
                        }
                        if (k == 0) {
                            tmp -= nums[3];
                        } else {
                            tmp += nums[3];
                        }
                        sb.deleteCharAt(sb.length() - 1);
                        sb.deleteCharAt(sb.length() - 1);
                    }
                    if (j == 0) {
                        tmp -= nums[2];
                    } else {
                        tmp += nums[2];
                    }
                    sb.deleteCharAt(sb.length() - 1);
                    sb.deleteCharAt(sb.length() - 1);
                }
            }
        }

    }
}



Measured memory_bytes: 22740
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var K = int.Parse(Console.ReadLine());
            var answer = 0;
            foreach (var a in Enumerable.Range(0, K).Select(elem => elem + 1))
            {
                foreach (var b in Enumerable.Range(0, K).Select(elem => elem + 1))
                {
                    foreach (var c in Enumerable.Range(0, K).Select(elem => elem + 1))
                    {
                        answer += Gcd(Gcd(a, b), c);
                    }
                }
            }

            Console.WriteLine(answer);
        }

        public int GcdRecursive(int a, int b)
        {
            var answer = b == 0 ? a : GcdRecursive(b, a % b);
            return answer;
        }

        public int Gcd(int a, int b)
        {
            if (a < b)
            {
                return GcdRecursive(b, a);
            }
            else
            {
                return GcdRecursive(a, b);
            }
        }
    }
}


Measured memory_bytes: 31308
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,res=100000;
  cin>>n;
  vector<int> w(n),ws(n,0),wr(n,0);
  for(auto& i:w)cin>>i;
  ws=wr=w;
  for(int i=1;i<n;++i){
    ws[i]+=ws[i-1];
    wr[n-1-i]+=wr[n-i];
  }
  for(int i=0;i<n-1;++i)res=min(res,abs(ws[i]-wr[i+1]));
  cout<<res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}



  








      

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

    int cnt[N + 1];
    // i文字目までにWがいくつあるか(1-indexed)

    // 累積和テーブルを埋めていく
    cnt[0] = 0;
    for (int i = 0; i < N; ++i) {
        cnt[i + 1] = cnt[i];
        if (S[i] == 'W') ++cnt[i + 1];
    }

    int ans = N;
    for (int i = 1; i <= N; ++i) {
        // 自分より西にいて西を向いている人が
        //  cnt[i-1]人
        // 自分より東にいて東を向いている人が
        //  (N-i)-(cnt[N]-cnt[i])人
        ans = min(ans, cnt[i - 1] + (N - i) - (cnt[N] - cnt[i]));
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 4884
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <unordered_map>

using namespace std;

class Node{
private:
    int name;
    long long cnt;
    long long sum;
    list<Node*> next;
public: 
    Node(int n){
        name = n;
        cnt = 0;
        sum = 0;
    }
    void setNext(Node* n){
        next.emplace_back(n);
    }
    void setCnt(int n){
        cnt += n;
    }
    void sumCnt(int n){
        sum += cnt+n;
        for(auto itr = next.begin(); itr != next.end(); ++itr){
            (*itr)->sumCnt(cnt+n);
        }
    }
    void sumcnt(int n){

    }
    long long printSum(){
        return sum;
    }
};

int main() {
    int N, Q;
    cin >> N >> Q;
    unordered_map<int, Node*> Map;
    int count = 1;
    for(int i = 1; i <= N; ++i){
        Node* tmp = new Node(i);
        Map.insert(make_pair(count, tmp));
        count++;
    }
    for(int i = 1; i <= N-1; ++i){
        int a, b;
        cin >> a >> b;
        Map[a]->setNext(Map[b]);
    }
    for(int i = 0; i < Q; ++i){
        int p, x;
        cin >> p >> x;
        Map[p]->setCnt(x);
    }
    Map[1]->sumCnt(0);
    for(int i = 1; i <= N; ++i){
        cout << Map[i]->printSum() << " ";
    }
    cout << endl;
    

    return 0;
}

Measured memory_bytes: 32200
#include <iostream>

using namespace std;

int main()
{
    int n;
    
    while(true)
    {
        scanf("%d", &n);
        
        if(n == 0) break;
        
        int ret = 0;
        
        for(int i = 1; i < n; i++)
        {
            for(int j = 2; j <= n / i; j++)
            {
                int sum = 0;
                
                for(int k = i; k < i + j; k++)
                {
                    sum += k;
                }
                
                if(sum == n) ret++;
            }
        }
        
        printf("%d\n", ret);
    }
    
    return 0;
}

Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
//define
#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define str string
#define vint vector<int>
#define vvint vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vool vector<bool>
#define vtr vector<str>
#define vvtr vector<vector<str>>
#define pb() push_back()
#define elif else if
#define all(x) x.begin(),x.end()
//function
int shizuku(int,int);
//UnionFind
struct UnionFind{
  vint par;
  UnionFind(int N):par(N){
    rep(0,N)par[i]=i;
  }
  int root(int x){
    if(par[x]==x)return x;
    return par[x]=root(par[x]);
  }
  void unite(int x,int y){
    int rx=root(x);
    int ry=root(y);
    if(rx==ry)return;
    par[rx]=ry;
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
};

signed main(){
    int D,G,N,M,X,count=0,count2=0;
    double d;
    int C='A'-'a';
    char op;
    str S,T;
    cin>>S>>T;
    rep(0,S.size()){
      char s=S.at(0);
      S=S+s;
      S.erase(S.begin());
      if(S==T)count+=1;
    }
    if(count>0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

unsigned GetDigit(unsigned num){
    return log10(num)+1;
}
main(){
  long int n,root,div,keep,maxnumber;
  cin >> n;
  root = (int)sqrt(n);
  keep=11;
  for(int i=1;i<=root;i++){
    div=n/i;
    if(n%i==0){
            maxnumber = max(GetDigit(i),GetDigit(div));
            keep = min(keep,maxnumber);
    }
  }
  cout << keep;
}

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

using lint = long long;

int main() {
    lint a, b, c;
    cin >> a >> b >> c;
    lint ans = 0;
    lint eat = min(a, c);
    ans += eat;
    c -= eat;
    eat = min(b, c);
    ans += 2 * eat;
    b -= eat;
    c -= eat;
    ans += b;
    if (c > 0) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define YES(i) cout << ((i) ? "Yes" : "No") << endl;
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
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; }

int main() {
    VI a(3);
    cin >> a[0] >> a[1] >> a[2];
    SORT(a);
    cout << a[0] + a[1] << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
#define int long long int
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);

void solve(long long a, long long b, long long c)
{
  YesNo(c - a - b > 0 && (4ll * a * b < (c - a - b) * (c - a - b)));
}

signed main()
{
  long long a;
  scanf("%lld", &a);
  long long b;
  scanf("%lld", &b);
  long long c;
  scanf("%lld", &c);
  solve(a, b, c);
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
template<typename T>
void print(T x) {
    cout << x << endl;
}
int main(void) {
    int a, b, t; cin >> a >> b >> t;
    cout << t/a*b;
}


Measured memory_bytes: 256
N, L = map(int,input().split())
a = list(map(int,input().split()))
t = True
key_number = -1
for i in range(1,N):
    if a[i] + a[i-1] >= L:
        t = False
        key_number = i

if t:
    print("Impossible")
else:
    print("Possible")
    for ans in range(1,key_number):
        print(ans)
    for ans in range(N-1,key_number-1,-1):
        print(ans)

Measured memory_bytes: 63856
#include <stdio.h>
int main(void){
    int d, r;
    double a, b, f;
    
    scanf("%lf %lf", &a, &b);
    
    d = (int)a / b;
    r = (int)a % (int)b;
    f = a / b;
    
    printf("%d %d %0.5f\n", d, r, f);
    
    return 0;
    
}



Measured memory_bytes: 2072
N = int(input())
S = input()
MOJI0='ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
MOJI1=MOJI0[N:N+26]
ans=[]
for i in range(len(S)):
    pos=MOJI0.find(S[i])
    ans += MOJI1[pos]
ans = ''.join(ans)
   
print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> PL;
typedef long double ldouble;

int n[2];
int a[2][100010];

const int MOD = 1e9 + 7;

void solve(){
	ll ans = 1;
	scanf("%d%d", n, n+1);
	rep(i, 2)rep(j, n[i])scanf("%d", a[i]+j);
	rep(u, 2){
		ll cnt = 0;
		for(int j=1;j<n[u];j++){
			ll b = (ll)j * (n[u]-j) % MOD;
			b = b * (a[u][j] - a[u][j-1]) % MOD;
			cnt = (cnt + b) % MOD;
		}
		ans = ans * cnt % MOD;
	}
	printf("%lld\n", ans);
}

int main(){
	int Tc = 1; // scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		// printf("Case #%d: ", tc);
		solve();
	}
}

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

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007

    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
         int r,d,x;
         cin>>r>>d>>x;
         rep(1,11){
            x=r*x-d;
            cout<<x<<endl;
         }

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

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int N;
	scanf("%d",&N);
	int A[N];
	int B[N];
	int C[N];
	int K=0,i;
	for(i=1;i<N+1;i++){
		scanf("%d",&A[i]);
	}
	for(i=1;i<N+1;i++){
		scanf("%d",&B[i]);
	}
	for(i=1;i<N;i++){
		scanf("%d",&C[i]);
	}
	
	for(i=1;i<N+1;i++){
		K=K+B[i];
		if(A[i]-A[i-1]==1){
			K=K+C[A[i-1]];
		}
	}
	printf("%d",K);
}

Measured memory_bytes: 128
import heapq

n = int(input())
C = [[] for _ in range(n)]
for _ in range(n):
    tmp = list(map(int,input().split()))
    for i in range(1,tmp[1]+1):
        C[tmp[0]].append(tuple(tmp[2*i:2*i+2]))

q = []

def heap_dijkstra(start = 0):
    visited = [False]*n
    INF = 10000000000
    d = [INF]*n

    d[start] = 0
    visited[start] = True
    add_node = start

    for i in range(n-1):
        for adj_weight in C[add_node]:
            if visited[adj_weight[0]] == False:
                heapq.heappush(q,(d[add_node]+adj_weight[1],adj_weight[0]))

        while 1:
            tmp = heapq.heappop(q)
            if visited[tmp[1]] == False:
                min_weight = tmp[0]
                min_node = tmp[1]
                break
        
        add_node = min_node
        visited[min_node] = True
        d[min_node] = min_weight
    
    return d

D = heap_dijkstra()

for i in range(n):
    print("{} {}".format(i,D[i]))


Measured memory_bytes: 93056