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

using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ll long long
#define li long int
#define ld long double
#define lld long long double

#define pb push_back
#define mk make_pair
#define F first
#define S second

#define all(v) (v).begin(),(v).end()
#define fill(a) memset(a, 0, sizeof(a))

const int MX = 1e6;
const int MI = -1e6;
const int MOD = 1e9 + 7;
const string ALPHA = "abcdefghijklmnopqrstuvwxyz";
const double PI = 3.1415926535;

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

const int mod=1e9+7;
inline int add(int x,int y)
{
  x+=y;
  if (x>=mod)
    return x-mod;
  return x;
}
inline int sub(int x,int y)
{
  x-=y;
  if (x<0)
    return x+mod;
  return x;
}
inline int mul(int x,int y)
{
  return (x*1ll*y)%mod;
}
inline int power(int x,int y)
{
  int ans=1;
  while(y)
    {
      if (y&1) ans=mul(ans,x);
      x=mul(x,x);
      y>>=1;
    }
  return ans;
}
inline int inv(int x)
{
  return power(x,mod-2);
}
inline int gcd(int x, int y)
{
  return(y!=0)?gcd(y, x%y):x;
}
inline ll nPr(int n, int r)
{
  ll i,result=1;
  rep(i,r)
    {
      result*=(ll)(n-i);
    }
  return result;
}
inline ll nCr(int n,int r)
{
  ll i,result=1;
  rep(i,min(r,n-r))
    {
      result*=(ll)(n-i);
      result/=(ll)(i+1);
    }
  return result;
}
bool prime(int n)
{
  for (int i=2; i<n/2; i++)
    {
      if(n%i==0)
	return false;
    }
  return true;
}

/*------------CODE->BEGINS------------*/



int main()
{
  IOS;
  int n;
  cin >> n;
  if (n==0){
    cout << 1 << endl;
  }
  else if (n==1){
    cout << 0 << endl;
  }
  return 0;
}


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


Measured memory_bytes: 50540
#include <iostream>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

void solve()
{
	int step, delta_theta;
	double x = 0;
	double y = 0;
	int theta = 90;
	while(scanf("%d,%d", &step, &delta_theta))
	{
		if(!step && !delta_theta)
		{
			break;
		}
		x += step * cos(theta * M_PI / 180);
		y += step * sin(theta * M_PI / 180);
		theta -= delta_theta;
	}
	cout << (int)x << endl;
	cout << (int)y << endl;
}

int main()
{
	solve();
	return(0);
}

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

int main()
{
    int a, b, c, n;

    scanf("%d", &a);
    scanf("%d", &n);
    scanf("%d", &n);
    scanf("%d", &n);
    scanf("%d", &b);
    scanf("%d", &c);

    //printf("%d,%d,%d\n", a, b, c); 

    if(b - a <= c){
        printf("Yay!");
    }
    else{
        printf(":(");
    }

    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#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--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

const int N=101000;
int n,p[N];
int mid(int x,int y,int z) {
	if (x>y) swap(x,y);
	if (x>z) swap(x,z);
	if (y>z) swap(y,z);
	return y;
}
int x;
int main() {
	scanf("%d",&n);
	scanf("%d",&x);
	if (x==1||x==2*n-1) {
		puts("No");
		return 0;
	}
	puts("Yes");
	int md=n;
	if (x<=n) {
		rep(i,1,n+1) if (i!=x&&i!=x-1) printf("%d\n",i);
		printf("%d\n%d\n",x-1,x);
		rep(i,n+1,2*n) printf("%d\n",i);
//		puts("");
	} else {
		x=2*n-x;
		rep(i,1,n+1) if (i!=x&&i!=x-1) printf("%d\n",2*n-i);
		printf("%d\n%d\n",2*n-x+1,2*n-x);
		rep(i,n+1,2*n) printf("%d\n",2*n-i);

	}
/*	n=9;
	rep(i,0,n) p[i]=i;
	while (1) {
		VI q(p,p+n);
		while (SZ(q)>1) {
			VI r;
			rep(i,0,SZ(q)-2) r.pb(mid(q[i],q[i+1],q[i+2]));
//			for (auto v:q) printf("%d ",v); puts("");
			q=r;
		}
		if (q[0]==4) {
//			printf("%d\n",q[0]);
			rep(i,0,n) printf("%d ",p[i]); puts("");
			break;
		}
		if (!next_permutation(p,p+n)) break;
	}
*/
}


Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int dp[5001][5001];

int main() {

	int N;
	string S;
	cin >> N >> S;
	
	dp[0][0] = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = i + 1; j <= N; j++) {
			if (S[i - 1] != S[j - 1]) continue;
			dp[i][j] = min(dp[i - 1][j - 1] + 1, j - i);
		}
	}
	int ans = 0;
	for (int i = 0; i <= N; i++)for (int j = 0; j <= N; j++)ans = max(ans, dp[i][j]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 96768
#include <stdio.h>
int main(void){
    long long int A, B, ans = 0;
    if (scanf("%lld %lld", &A, &B) == -1) return 0;
    if (A % 2 == 1) {
        ans ^= A;
        for (int i = 0; i < (B - A) % 4; i++) ans ^= B - i;
    }
    else {
        for (int i = 0; i < (B - A + 1) % 4; i++) ans ^= B - i;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
typedef long long ll;
ll n, a, b, c, d;
bool ans = false;
int main(void){
    // Your code here!
    cin >> n >> a >> b >> c >> d;
    for (ll i = 0; i < n; i++) {
        if (b - a < i * c - (n - i - 1) * d) continue;
        if (b - a > i * d - (n - i - 1) * c) continue;
        ans = true;
    }
    cout << (ans ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int a; cin>>a;
    cout << a+a*a+a*a*a << '\n';
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    ll x, k, d;
    cin >> x >> k >> d;
    if(abs(x) / d > k){
      cout << abs(abs(x) - k * d) << endl;
    }else{
        ll step = abs(x) / d;
        if ((k - step) % 2) {
          cout << abs(abs(x) - step * d - d) << endl;
        } else {
          cout << abs(abs(x) - step * d) << endl;
        }
    }
    return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);
const int MAX_LOG = (int)(335 + 5);

string s;

int n;
int doubling[MAX_LOG][MAX_N];

string binexp = "100100100100110101101001001011001010011000011011111010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";

void make_doubling() {
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'R') {
      doubling[0][i] = i + 1;
    } else {
      doubling[0][i] = i - 1;
    }
  }

  for (int i = 1; i < MAX_LOG; ++i) {
    for (int j = 0; j < n; ++j) {
      int fst = doubling[i - 1][j];
      int snd = doubling[i - 1][fst];
      doubling[i][j] = snd;
    }
  }
}

int after[MAX_N];

int ans[MAX_N];

int main(void) {
  // Here your code !
  cin >> s;

  n = s.size();

  make_doubling();

  for (int i = 0; i < n; ++i) {
    after[i] = i;
  }

  for (int i = 0; i < binexp.size(); ++i) {
    if (binexp[i] == '0') continue;

    for (int j = 0; j < n; ++j) {
      after[j] = doubling[i][j];
    }
  }

  for (int i = 0; i < n; ++i) {
    ans[after[i]] += 1;
  }

  for (int i = 0; i < n; ++i) {
    printf("%d ", ans[i]);
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 134272
// 

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

int main(){
  double data[1050];
  data[0] = 0;
  for(int i = 0; i < 1050; i++){
    data[i] = 0;
  }
  for(int i = 1; i < 1050; i++){
    data[i] += data[i - 1] + i;
  }

  int a, b;
  cin >> a >> b;
  for(int i = 1; i < 1050; i++){
    // cout << data[i] << endl;
    if((data[i] - b) == (data[i-1] - a)){
      cout << data[i] - b << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

# Kの倍数を全網羅する方針？
# 最大長は3N
# 2, 4, 6, 8
if __name__ == "__main__":
    N, K = map(int, sys.stdin.readline().split())
    if K % 2 == 0:
        a = N // K
        # b = (N + (K // 2)) // K
        b = N // (K // 2) - a
        print(a ** 3 + b ** 3)
    else:
        a = N // K
        print(a ** 3)



Measured memory_bytes: 5072
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
#define inf 2147483647
#define eps 1e-9
using namespace std;
typedef long long ll;
int n,N,cnt=0,s[501],num[501],tot[501],a[250001];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&num[i]);
		a[num[i]]=i;
		tot[i]=i-1;
	}
	N=n*n;
	for(int i=1;i<=N;i++){
		if(a[i])s[++cnt]=a[i];
	}
	for(int i=1;i<=N;i++){
		if(a[i])continue;
		for(int j=1;j<=n;j++){
			if(!tot[s[j]])continue;
			a[i]=s[j];
			tot[s[j]]--;
			break;
		}
	}
	for(int i=1;i<=n;i++){
		tot[i]=n-i;
	}
	for(int i=N;i;i--){
		if(a[i])continue;
		for(int j=n;j;j--){
			if(!tot[s[j]])continue;
			a[i]=s[j];
			tot[s[j]]--;
			break;
		}
	}
	for(int i=1;i<=n;i++){
		int tmp=0;
		for(int j=1;j<=N;j++){
			if(a[j]==i)tmp++;
			if(tmp==i){
				if(j!=num[i])return puts("No"),0;
				break;
			}
		}
	}
	puts("Yes");
	for(int i=1;i<=N;i++)printf("%d ",a[i]);
	return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
double EXP(int n){
	if(n%2==0) return double(n/2)+0.5;
	else return double(n/2)+1.0;
}
int main(){
  	int N, K;
  	cin >> N >> K;
  	int a[N];
  	double p[N];
  	for(int i=0;i<N;i++){
  		cin >> a[i];
  		p[i] = EXP(a[i]);
  	}

  	double M = 0;
  	for(int i=0;i<K;i++){
  		M += p[i];
  	}

  	double ans = M;
  	for(int i=K;i<N;i++){
  		M -= p[i-K];
  		M += p[i];
  		if(M>ans){
  			ans = M;
  		}
  	} 

  	cout << fixed << setprecision(8) << ans <<endl;
    
  	return 0;
}













Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n,x; cin>>n>>x;
    int a[n]; rep(i,n) cin>>a[i];
    long long ans=0;
    rep(i,n){
        // cout<<ans<<endl;
        if(a[i]>x){
            ans+=a[i]-x;
            a[i]-=a[i]-x;
        }
        if(i&&a[i-1]+a[i]>x){
            ans+=a[i-1]+a[i]-x;
            a[i]-=a[i-1]+a[i]-x;
        }
    }
    // rep(i,n) cout<<a[i]<<endl;
    cout<<ans<<endl;
    return 0;
}


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

int check_unbalance(string s)
{
  map<char,int> mp;

  mp[s[0]]++;
  mp[s[1]]++;
  mp[s[2]]++;

  if(mp.size() != 3)
    return 1;

  return 0;
}

int main()
{
  string S;

  cin >> S;
  if(S.length() == 2)
    if(S[0] == S[1])
    {
      cout << "1 2" << endl;
      return 0;
    }

  for(int i=0; i<S.length()-2;i++)
  {
    if(check_unbalance(S.substr(i,3)))
    {
      cout << i+1 << " " << i+3 << endl;
      return 0;
    }
  }

  cout << -1 << " " << -1 << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;
 
int main() {
    string s;
    cin >> s;
    ll k;
    cin >> k;

    ll i = 0;
    while (s[i] == '1' && k > 1) {
        ++i;
        --k;
    }
    cout << s[i] << endl;
}


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

int x[3]={};

int main(){
	int rew,rel,cx,cy,r;
	cin>>rew>>rel>>cx>>cy>>r;
	if (cx+r<=rew && cx-r>=0 && cy+r<=rel && cy-r>=0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
}


Measured memory_bytes: 3092
#include <iostream>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int a , b , s1 , s2 , s3 ;
    cin >> a >> b ;
    s1 = a+b ;
    s2 = a*b ;
    s3 = a-b ;
    cout << max(max(s1,s2),s3) ;
    return 0;
}


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

using namespace std;

int main() {
  int a, b, c; cin >> a >> b >> c;
  for(int i = a; i < 100000; i += a) {
    if(i % b == c) {
      puts("YES");
      return 0;
    }
  }
  puts("NO");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int ans = 0;
	string s; cin >> s;
	rep(i, s.size() / 2) ans += s[i] != s[s.size() - 1 - i];
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
X, N = 6, 5
PRR = [4, 7, 10, 6, 5]

# X, N = 10, 5
# PRR = [4, 7, 10, 6, 5]

# X,N = 100, 0
# PRR = []

X, N = map(int, input().split())
PRR = list(map(int, input().split()))


def calculate(x, n, prr):
    up = x
    while up in prr:
        up = up + 1

    down = x - 1

    while down in prr:
        down = down - 1

    if abs(x - down) == abs(x - up):
        return min(down, up)

    if abs(x - down) < abs(x - up):
        return down
    else:
        return up


result = calculate(X, N, PRR)

print(result)


Measured memory_bytes: 9208
/******************************************
* AUTHOR : RAJAGOPALAN *
* NICK : ARNO *
* INSTITUTION : VIT *
******************************************/
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define FP(i, a, b, k) for (__typeof(a) i = a; i < b; i += k)
#define FS(i, a, b, k) for (__typeof(a) i = a; i > b; i -= k)
#define IT(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template <class T>
inline T gcd(T x, T y)
{
	if (!y)
		return x;
	return gcd(y, x % y);
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
	return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
	assert(__gcd(a, m) == 1);
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m, a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
	if (y == 0)
		return 1LL;
	else if (y == 1)
		return x;
	else
	{
		ll ans = modPow(x, y / 2, m) % m;
		if (y & 1)
		{
			return (((ans * ans) % m) * x) % m;
		}
		else
		{
			return (ans * ans) % m;
		}
	}
}

vector<string> split(char d,string s)
{
	stringstream ss(s);
	string t;
	vector<string> words;
	while(getline(ss,t,d))
	{
		words.pb(t);
	}

	return words;
}

int main(int argc, char *argv[])
{
#ifdef LOCAL
	auto start = chrono::high_resolution_clock::now();
#endif
	
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
	cin>>s;

	set<char> ss(all(s));
	if(ss.find('7')!=ss.end())
	cout<<"Yes";
	else cout<<"No";


#ifdef LOCAL
	auto end = chrono::high_resolution_clock::now();
	double time_taken =
		chrono::duration_cast<chrono::nanoseconds>(end - start).count();

	time_taken *= 1e-9;

	cout << "Time taken by program is : " << fixed
		 << time_taken * 1000 << setprecision(9);
	cout << " sec" << endl;
#endif
	return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> p(n);
  int found=0;
  for(int i=0;i<n;++i){
    cin >> p.at(i);
    if(p.at(i)!=i+1){
      found+=1;
      if(found==3){
        cout << "NO";
        return 0;
      }
    }
  }
  
  cout << "YES";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;

int main() {
    ll N, x, a, tmp;
    string s, AZ;
    cin >> N;
    x = 26;
    AZ = "zabcdefghijklmnopqrstuvwxy";

    while (N > 0) {
        s = AZ[N % x] + s;
        N = (N - 1) / x;
    }
    cout << s;

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#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 all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

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

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

    int N;
    cin>>N;
    map<string, int> map;
    rep(i,N){
        string S;
        cin>>S;
        map[S]++;
    }
    int maxx = 0;
    for(auto p:map){
        chmax(maxx, p.second);
    }
    vector<string> ans;
    for(auto p:map){
        if(p.second == maxx)ans.push_back(p.first);
    }
    sort(all(ans));
    rep(i,ans.size())cout<<ans[i]<<endl;
}

Measured memory_bytes: 25584
// https://atcoder.jp/contests/abc054/tasks/abc054_c
// 再帰DFS で全通りの経路を見る
// 引数に今いるノードと探索したノードを渡す
// 全部のノードに到達したら1カウント
#include <bits/stdc++.h>
using namespace std;
#define int long long
using P = pair<int, int>;
constexpr array<int, 4> dx = {1, 0, -1, 0};
constexpr array<int, 4> dy = {0, 1, 0, -1};
constexpr int INF = 1234567890;
constexpr int MOD = 1000000000 + 7;
// constexpr int MOD = 998244353;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int fact(int n) { return n > 1 ? n * fact(n - 1) % MOD : 1; }
int modinv(int a)
{
    int b = MOD, u = 1, v = 0;
    while (b)
    {
        int t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= MOD;
    if (u < 0)
        u += MOD;
    return u;
}
constexpr int modpow(int a, int n)
{
    int rtn = 1;
    while (n > 0)
    {
        if (n & 1)
            rtn = rtn * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return rtn;
}

int n, m;
// パスを表す
vector<vector<int>> to;

int dfs(int here, int seen)
{
    // 全部のノードにたどり着ける経路を数える
    static int count = 0;

    // 全部のノードにたどり着いているか
    if (seen == pow(2, n) - 1)
        count++;

    // 今いるノードにつながった辺について調べる
    for (auto &&next : to[here])
    {
        // 次のノードを探索してないかどうか
        if (seen & 1 << next)
            continue;
        // 次のノードに移動
        dfs(next, seen | 1 << next);
    }

    return count;
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << setprecision(10);

    cin >> n >> m;
    to.resize(n);
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        to[a - 1].push_back(b - 1);
        to[b - 1].push_back(a - 1);
    }

    // ノード0から探索する 第2引数はノード0を探索したことを意味する
    cout << dfs(0, 0b1) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){ 
   string s,t,u;
   cin>>s>>t;
   int a,b;
   cin>>a>>b;
   cin>>u;
   if(u==s){
       cout<<(a-1)<<" "<<b<<endl;
   }
    else{
        cout<<a<<" "<<(b-1)<<endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
  
int main(void)
{
 double x,y,r;
 double x1,x2,x3,y1,y2,y3;
 double ecm[2][3];
 double a,b,A;
 int i;
 int n;
  
 scanf("%d",&n);
 for(i = 0; i < n; i++)
 {
  scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
  ecm[0][0] = x1 - x2;
  ecm[0][1] = y1 - y2;
  ecm[0][2] = (x2*x2 + y2*y2) - (x1*x1 + y1*y1);
  ecm[1][0] = x1 - x3;
  ecm[1][1] = y1 - y3;
  ecm[1][2] = (x3*x3 + y3*y3) - (x1*x1 + y1*y1);
  A = (ecm[0][0]*ecm[1][1])-(ecm[0][1]*ecm[1][0]); 
  a = ((ecm[0][2]*ecm[1][1])-(ecm[0][1]*ecm[1][2]))/A+0;
  b = ((ecm[0][0]*ecm[1][2])-(ecm[0][2]*ecm[1][0]))/A+0;
  x = (a/-2.0);
  y = (b/-2.0);
  r = sqrt(pow(x1-x,2)+pow(y1-y,2));
  printf("%.3f %.3f %.3f\n",x,y,r); 
 }
 return 0;
}

Measured memory_bytes: 656
import sys


class SegmentTree:
    """
    https://qiita.com/dn6049949/items/afa12d5d079f518de368 から拝借しています。
    """

    def __init__(self, size, f=lambda x, y: max(x, y), default=0):
        self.size = 2 ** (size - 1).bit_length()
        self.default = default
        self.dat = [default] * (self.size * 2)
        self.f = f

    def update(self, i, x):
        i += self.size
        self.dat[i] = x
        while i > 0:
            i >>= 1
            self.dat[i] = self.f(self.dat[i * 2], self.dat[i * 2 + 1])

    def query(self, l, r):
        l += self.size
        r += self.size
        lres, rres = self.default, self.default
        while l < r:
            if l & 1:
                lres = self.f(lres, self.dat[l])
                l += 1

            if r & 1:
                r -= 1
                rres = self.f(self.dat[r], rres)
            l >>= 1
            r >>= 1
        res = self.f(lres, rres)
        return res


input = sys.stdin.buffer.readline

N, K = map(int, input().split())
MAX = 300010
B = SegmentTree(MAX)
for _ in range(N):
    a = int(input()) + 1
    m = B.query(max(1, a - K), min(MAX, a + K + 1))
    B.update(a, m + 1)
print(B.query(1, MAX))


Measured memory_bytes: 102600
#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    ll mul = 1, add = 0;
    for(int i = 0; i < n; i++){
        int q, x;
        cin >> q >> x;
        if(q == 1){
            mul *= x, add *= x;
        }else if(q == 2){
            add += x;
        }else if(q == 3){
            add -= x;
        }
    }
    cout << -add << " " << mul << endl;
    return 0;
}


Measured memory_bytes: 3120
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N, M = MI()
H = LMI()
nl = [list() for _ in range(N)]
for _ in range(M):
    a, b = MI()
    a -= 1
    b -= 1
    nl[a].append(b)
    nl[b].append(a)

ans = 0
for i in range(N):
    good = True
    for j in nl[i]:
        if H[i] <= H[j]:
            good = False
            break
    if good:
        ans += 1
print(ans)

Measured memory_bytes: 89604
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <string>
#include <unordered_map>
#include <set>
#include <stdlib.h>
#include <cmath>
#include <math.h>
#include <fstream>
#include <bitset>
#include <time.h>
#define int long long
using namespace std;
int n, k, ai;
vector<int> data;
int gcd(int a, int b){
    if (b == 0) return a;
    return gcd(b, a%b);
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin >> n >> k;
    for (int i=0; i < n; i++){
        cin >> ai;
        data.push_back(ai);
    }
    sort(data.begin(), data.end());
    int g = data[0];
    for (int i=1;i<n;i++){
        g = gcd(g, data[i]);
    }
    if (k <= data.back() && k % g == 0){
    cout << "POSSIBLE" << endl;}
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 1400
n = int(input())
barr = list(map(int, input().split()))

arr = []

arr.append(barr[0])

for i in range(0, n - 1):
    if i == n - 2:
        arr.append((barr[i]))
    else:
        arr.append(min(barr[i], barr[i + 1]))

print(sum(arr))


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  string s;
  cin>>s;
  int n=s.size();
  string t;
  bool ans=false;
  REP(i, n){
    FOR(j, i, n){
      t=s.substr(0, i) + s.substr(j, n-j);
      if(t=="keyence"){
        ans=true;
      }
    }
  }
  if(ans) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;

  return 0;
}


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

using namespace std;

int
main() {
    uint64_t a, b, k;
    cin >> a >> b >> k;

    if (a > k) {
        a -= k;
    } else {
        k -= a;
        a = 0;
        if (b > k) {
            b -= k;
        } else {
            b = 0;
        }
    }

    cout << a << " " << b << endl;

    return 0;
}

Measured memory_bytes: 256
n=int(input())
A=list(map(int,input().split()))
ma=int(200200)
B=[0]*ma

for i in range(n):
    B[A[i]]+=1

ans=int(0)
for i in range(ma):
    ans+=int((B[i]-1)*B[i]/2)

for i in range(n):
    print(ans-B[A[i]]+1)

Measured memory_bytes: 26268
#include <iostream>
#include <algorithm>
using namespace std;
int n,m,x=10000,ans;
int main(void){
    cin>>n>>m;
    ans=n;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        m-=a;
        x=min(x,a);
    }
    cout<<ans+m/x<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define r(i,a,n) for(int i=a;i<(int)(n);i++)
using namespace std;
const int MAX_N = 1E+5;
typedef long long ll;
ll x[MAX_N];
ll dist[MAX_N];
int N;
ll X,D;

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

int main(){
        cin>>N>>X;
        r(i,0,N){
                cin>>x[i];
                dist[i]=abs(X-x[i]);
        }
        int divis=dist[0];
        r(i,1,N){
          		/*
                int r,n,m;
                if(divis>dist[i]){
                        m=divis;
                        n=dist[i];
                }else{
                        m=dist[i];
                        n=divis;
                }
                while((r=n%m)!=0){
                        m=n;
                        n=r;
                }
                divis=n;
                */
          
          		divis = gcd(divis,dist[i]);
        }
        D=divis;
        cout<<D<<endl;
        return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<numeric>
#include<algorithm>
using namespace std;
int lcm(int ans, int a) {
    return (ans * a) / __gcd(ans, a);
}
int main() {
    int n;
    cin >> n;
    int ans = 1;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        ans = lcm(ans, a);
    }
    cout << ans << endl;
}




Measured memory_bytes: 3124
from fractions import gcd
n,m=map(int,input().split())
*a,=map(int,input().split())

g=a[0]
lcm=a[0]

for i in range(1,n):
    g=gcd(lcm,a[i])
    lcm*=a[i]
    lcm//=g

for i in range(n):
    if lcm//a[i]%2==0:
        print(0)
        exit(0)

print((2*m//lcm+1)//2)

Measured memory_bytes: 94100
k,n = map(int, input().split())
l_1 = [int(x) for x in input().split()]
l_2 = []
for i in range(n-1):
    dis = l_1[i+1]-l_1[i]
    l_2.append(dis)
dis = k-l_1[n-1]+l_1[0]
l_2.append(dis)
#print(l_2)
ans = k-max(l_2)
print(ans)

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


int main() {
	int a, b, c;
    cin >> a >> b >> c;
	if(a==b && a!=c) 
      cout << "Yes" << endl;
 	else if(a==c && a!=b) cout << "Yes" << endl;
  	else if(b==c && a!=b) cout << "Yes" << endl;
    else  cout << "No" << endl;
  
}

Measured memory_bytes: 256
use std::cmp::{self, Ordering};
use std::collections::*;
use std::io::{self, Read};

const MOD: usize = 1000000007;

fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock());

    let n: usize = sc.read().unwrap();
    let m: usize = sc.read().unwrap();
    let a: Vec<usize> = sc.read_vec(n).unwrap();

    let mut h = HashMap::new();
    h.insert(0, 1);
    for v in a
        .iter()
        .scan(0, |acc, x| {
            *acc += *x;
            Some(*acc)
        })
        .map(|x| x % m)
    {
        let c = h.entry(v).or_insert(0);
        *c += 1;
    }

    // println!("{:?}", h);

    let ans = h
        .values()
        .fold(0, |acc, x| acc + x * (x - 1 as usize) / 2 as usize);
    println!("{}", ans);
}

struct Scanner<R: Read> {
    reader: R,
}

impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: std::str::FromStr>(&mut self) -> Option<T> {
        self.reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse()
            .ok()
    }

    fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Option<Vec<T>> {
        (0..n).map(|_| self.read()).collect()
    }

    fn read_vec2d<T: std::str::FromStr>(&mut self, m: usize, n: usize) -> Option<Vec<Vec<T>>> {
        (0..m).map(|_| self.read_vec(n)).collect()
    }

    fn read_board(&mut self, n: usize) -> Option<Vec<Vec<char>>> {
        (0..n)
            .map(|_| {
                self.read::<String>()
                    .map(|s| s.chars().collect::<Vec<char>>())
            })
            .collect()
    }
}


Measured memory_bytes: 12540
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]

#二次元配列の部分配列を抽出する手法
#[l[i:m+i] for l in a[i:m+i]]
if m==1:
    for i in range(n):
        if b[0] in a[i]:
            print('Yes')
            exit()

    print('No')
    exit()
if m==n:
    if a==b:
        print('Yes')
        exit()
    else:
        print('No')
        exit()

for i in range(n-m):
    for j in range(n-m):
        if [l[j:m+j] for l in a[i:m+i]]==b:
            print('Yes')
            exit()

print('No')

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

int main(){
  int n,k;
  cin >> n >> k;
  map<int,int>ok;
  int b,c;
  for(int i=0;i<k;i++){
    cin >> b;
    for(int j=0;j<b;j++){
      cin >> c;
      ok[c-1]=1;
    }
  }
  int ans=0;
  for(int i=0;i<n;i++){
    if(ok[i]==1)
      ans++;
  }
  cout << n-ans << endl;
  return 0;
}

Measured memory_bytes: 3596
d[5000],c;main(w,n,i,C,W,b){for(;scanf("%d%d",&w,&n),w;printf("Case %d:\n%d\n%d\n",++c,d[w],b),bzero(d,w*5))for(;n--;)for(i=w,scanf("%d,%d",&C,&W);i>=W;i--)d[i]=fmax(d[i],d[i-W]+C),b=d[i]-d[w]?b:i;}

Measured memory_bytes: 0
#include <stdio.h>

int main(void)
{
    int n, m;
    int temp, flag;
    int i, j;
    
    while (1){
        scanf("%d%d", &n, &m);
        
        if (n + m == 0){
            break;
        }
        
        flag = 1;
        for (i = 0; i < m; i++){
            scanf("%d", &temp);
            
            if (temp == 1){
                flag = 0;
            }
        }
        
        printf("%f\n", flag == 1 ? n / 2.00 : 0);
    }
    
    return (0);
}

Measured memory_bytes: 0
def main():
    n = int(input())
    l = list(map(int,input().split()))
    l.sort()
    l.append(10**7)
    ans=0

    for i in range(n-2):
        for j in range(i+1,n-1):
            ok=j
            ng=n
            while ng-ok>1:
                mid = (ok + ng)//2
                if l[mid] < l[i] + l[j]:
                    ok=mid
                else:
                    ng=mid  
            ans+=ok-j
            
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 41948
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

int main() {
    int N,L; cin>>N>>L;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) {
        cin>>a[i];
    }
    int point=-1;
    for (int i = 0; i < N - 1; ++i) {
        if(a[i]+a[i+1]>=L){
            point=i;
            break;
        }
    }
    if(point==-1){
        cout<<"Impossible"<<endl;
        return 0;
    }

    cout<<"Possible"<<endl;
    for (int i = 1; i <= point; ++i) {
        cout<<i<<endl;
    }
    for (int i = N-1; i > point; --i) {
        cout<<i<<endl;
    }

    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"LINE %d: (%s) = ",__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
    IOS();
    int N;
    cin >> N;
    int ans = 0;
    for (int C=1;C<N;++C) {
        int tim = N-C;
        for (int A=1;A*A<=tim;++A) {
            if (tim % A == 0) {
                if (tim / A != A) ans += 2;
                else ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
import java.util.Scanner;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        long H = scan.nextLong();
        long W = scan.nextLong();
        
        if(H % 3 == 0) {
            System.out.println(0);
            return;
        }
        
        long answer;
        
        //縦切りのみ
        answer = H;
        
        //横切りのみ
        long difference = W;
        if(answer > difference) answer = difference;
        
        //横切り⇒縦切り
        for(int i = 1; i <= H; i++) {
            long width = i*W;
            long height1 = (H-i)*(W/2);
            long height2 = (H-i)*(W/2);
            if(W%2 != 0) height2 += (H-i);
            
            long max1 = maxValue(width, height1, height2);
            long min1 = minValue(width, height1, height2);
            difference = Math.abs(max1-min1);
            
            if(answer > difference) {
                answer = difference;
            }
        }
        
        //縦切り⇒横切り
        for(int i = 1; i <= W; i++) {
            long height = i*H;
            long width1 = (W-i)*(H/2);
            long width2 = (W-i)*(H/2);
            if(H%2 != 0) width2 += (W-i);
            
            long max2 = maxValue(height, width1, width2);
            long min2 = minValue(height, width1, width2);
            difference = Math.abs(max2-min2);

            if(answer > difference) {
                answer = difference;
            }
        }
        
        System.out.println(answer);
    }
    
    static long maxValue(long a, long b, long c) {
        if(a > b) {
            if(a > c) {
                return a;
            } else {
                return c;
            }
        } else {
            if(b > c) {
                return b;
            } else {
                return c;
            }
        }
    }
    
    static long minValue(long a, long b, long c) {
        if(a < b) {
            if(a < c) {
                return a;
            } else {
                return c;
            }
        } else {
            if(b < c) {
                return b;
            } else {
                return c;
            }
        }
    }
}


Measured memory_bytes: 24020
#include <bits/stdc++.h>
using namespace std;
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
    int K,N; cin>>K>>N;
    vector<int> A(N);

    rep(i,N){
        cin>>A.at(i);
    }
    vector<int> diff(N);
    rep(i,N-1){
        diff.at(i)=A.at(i+1)-A.at(i);
    }
    diff.at(N-1) = K - (A.at(N-1)-A.at(0));


    cout<<K- (*max_element(diff.begin(),diff.end()))<<endl;


 



 
}

Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
long long int a[100001],sa[200001],sum,mx,sum3;
int bina(int low,int high,long long int key)
{
	int mid;
	while(low<=high)	{
		mid=(low+high)/2;
		if(sa[mid]<key)	low=mid+1;
		else if(sa[mid]>key)	high=mid-1;
		else return mid;
	}
	return low;
}
int main(void)
{
	long long int wk,wk2,wk3,min1,min2,wkh;
	int i,j,lp,hp,flg,b;
	scanf("%d",&n);
	for(i=1;i<=n;i++)	{
		scanf("%lld",&a[i]);
	}
	sa[0]=0;
	for(i=1;i<=n;i++)	{
		sa[i]=sa[i-1]+a[i];
	}
	sum=sa[n];
	for(i=n+1;i<=2*n;i++)	{
		sa[i]=sa[i-n]+sum;
	}
	sum3=sum/3;
//	printf("sum=%lld\n",sum);
//	for(i=1;i<=n;i++)	printf("sa=%lld\n",sa[i]);
	
	mx=0;
	for(lp=0;lp<n;lp++)	{
		b=bina(lp,n+lp,sum3+sa[lp]);
		wk=sa[b-1]-sa[lp];
		hp=b-1;
		wkh=(sum-wk)/2;
		b=bina(hp,n+lp,wkh+sa[hp]);
		wk2=sa[b-1]-sa[hp];	wk3=sa[n+lp]-sa[b-1];
		min1=min(wk2,wk3);	min1=min(min1,wk);
//		printf("a:wk=%lld wk2=%lld wk3=%lld\n",wk,wk2,wk3);
		wk2=sa[b]-sa[hp];	wk3=sa[n+lp]-sa[b];
		min2=min(wk2,wk3);		min2=min(min2,wk);
//		printf("b:wk=%lld wk2=%lld wk3=%lld\n",wk,wk2,wk3);
		mx=max(mx,min1);	mx=max(mx,min2);	
	}
	printf("%lld\n",mx);
	return 0;
}


Measured memory_bytes: 3368
import java.util.*;

 
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String num = scan.nextLine();
        scan.close();
        
        switch (num.charAt(num.length()-1)) {
            case '2':
            case '4':
            case '5':
            case '7':
            case '9':
                System.out.println("hon");                
                break;
        
            case '0':
            case '1':
            case '6':
            case '8':
                System.out.println("pon");
                break;
            
            case '3':
                System.out.println("bon");
                break;

            default:
                break;
        }
    }
}



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

vector<vector<ll>> M;
vector<ll> is(200000);
const ll MOD = 1e9+7;

struct BW
{
	ll b,w;
};

BW dfs(ll now)
{
	BW res;
	res.b = 1;
	res.w = 1;
	for(auto i:M[now])
	{
		if(is[i]==0)
		{
			is[i] = 1;
			BW rs = dfs(i);	
			(res.w *= (rs.w+rs.b)%MOD)%=MOD;
			(res.b *= rs.w%MOD)%=MOD;
		}
	}

//	cout<<res.w<<';'<<res.b<<endl;
	return res;
}

int main()
{
	ll n;
	cin >> n;
	M = vector<vector<ll>>(n);

	for(ll i  =0;i<n-1;i++)
	{
		ll x,y;
		cin >> x >> y;
		x--;y--;
		M[x].push_back(y);
		M[y].push_back(x);
	}
	is[0]=1;
	BW ans = dfs(0);
	cout<<(ans.b+ans.w)%MOD<<endl;
	return 0;
}


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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll A, B; cin >> A >> B;
  cout << max(0LL, A - 2 * B) << endl;

  return 0;
}



Measured memory_bytes: 256