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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P   = pair<int, int>;

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

template <class T>
void dump_vec(const vector<T>& v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == (int)len - 1 ? "\n" : " ");
    }
}

struct FastIO {
    FastIO() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} FASTIO;

//---------------------------------------------------------------------------------------------------

map<i64, i64> prime_factors(i64 n) {
    map<i64, i64> res; // factor, num
    for (i64 p = 2; p * p <= n; p++) {
        while (n % p == 0) {
            res[p]++;
            n /= p;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

i64 eulers_phy_function(i64 n) {
    auto mp = prime_factors(n);
    f64 res = n;
    for (auto p : mp) {
        res *= 1.0 - (1.0 / p.first);
    }
    return (i64)res;
}
//---------------------------------------------------------------------------------------------------

// オイラーのファイ関数：https://mathtrain.jp/phi
signed main() {
    i64 N;
    cin >> N;
    auto ans = eulers_phy_function(N);
    cout << ans << "\n";
}



Measured memory_bytes: 3188
H,W=map(int,input().split())

MAT=[list(map(int, input().split())) for i in range(10)]
INM=[list(map(int, input().split())) for i in range(H)]


for k in range(10):
    for i in range(10):
        for j in range(10):
            MAT[i][j] = min(MAT[i][j], MAT[i][k] + MAT[k][j])
            MAT[j][i] = min(MAT[j][i], MAT[j][k] + MAT[k][i])

res = 0
for i in range(H):
    for j in range(W):
        if INM[i][j] != -1:
            res += MAT[INM[i][j]][1]

print(res)


Measured memory_bytes: 41180
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- 整数の入力
    x <- readLn
    -- 出力
    putStrLn . show . succ . length $ takeWhile (< x) $ scanl1 (+) [1..]


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

typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007


#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(int i=a;i<b;i++)
#define rlo(i,n) for(int i=n-1;i>=0;i--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define pr(a) {for(auto x:a)cout<<x<<" ";cout<<nl;}

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define yes cout<<"Yes"<<nl
#define no cout<<"No"<<nl
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

void f()
{
  ll n,sum=0,p;
  cin>>n;
  p=n;
  while(p>0)
  {
    sum+=p%10;
    p/=10;
  }
  if(n%sum==0)
    yes;
  else
    no;
}

int main()
{
    su;
    f();
    return 0;
}


Measured memory_bytes: 3640
import sys
sys.setrecursionlimit(1000000)
#def input():
#    return sys.stdin.readline()[:-1]

'''
n=int(input())
for i in range(n):
    a[i]=int(input())
    a[i],b[i]=map(int,input().split())
a=[int(x) for x in input().split()]
n,m=map(int,input.split())
from operator import itemgetter
a = [(1, "c", 1), (1, "b", 3), (2, "a", 0), (1, "a", 2)]
print(sorted(a))  # 0 番目の要素でソート、先頭の要素が同じなら 1 番目以降の要素も見る
print(sorted(a, key=itemgetter(0)))  # 0 番目の要素だけでソート
print(sorted(a, key=itemgetter(0, 2)))  # 0 番目と 2 番目の要素でソート
print(sorted(a, key=lambda x: x[0] * x[2]))  # 0 番目の要素 * 2 番目の要素でソート
print(sorted(a, reverse=True))  # 降順にソート
a.sort()  # 破壊的にソート、sorted() よりも高速
try: # エラーキャッチ list index out of range
    for i in range():
        k=b[i]
except IndexError as e:
    print(i)
'''

test_data1 = '''\
4
abcd
'''

test_data2 = '''\
3
baa
'''

test_data3 = '''\
5
abcab
'''
td_num=2

def GetTestData(index):
    if index==1:
        return test_data1
    if index==2:
        return test_data2
    if index==3:
        return test_data3
    
if False:
    with open("../test.txt", mode='w') as f:
        f.write(GetTestData(td_num))
    with open("../test.txt") as f:
        # Start Input code ---------------------------------------
        #n,m,c=map(int,f.readline().split())
        n=int(f.readline())
        s=str(f.readline())
        # End Input code ---------------------------------------
else:
    # Start Input code ---------------------------------------
    n=int(input())
    s=str(input())
    # End Input code ---------------------------------------
#print(n,s)
import string
al=string.ascii_lowercase
cnt=[]
for i in range(26):
    alc=s.count(al[i])
    #print(al[i])
    if alc!=0: cnt.append(alc)

#print(cnt)
m=len(cnt)
ans=1
mo=10**9 +7
counter=0
for i in range(m):
    ans*=(1+cnt[i]) % mo
ans-=1
'''
for i in range(1,2**m):
    counter+=1
    pat=1
    for j in range (m):
        #print(int((i % 2**(j+1)) / 2**j))
        ind=int((i % 2**(j+1)) / 2**j)
        pat*=max(1,cnt[j]*ind) % mo
        #print('ind,cnt[ind]=',ind,cnt[ind])
    ans+=pat
    #print(pat,ans)
    #print(bin(i))
'''
print(ans % mo)

Measured memory_bytes: 3896
#define ENABLE_LL
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std;

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr;
typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; }};
Scanner sc(cin);

const int MOD = 1000000007;
const int N = 200005;
int n;

void init() {
    scanf(I,&n);
}

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

int power(int exp) {
    int res = 1;
    while (exp--) (res *= 2) %= MOD;
    return res;
}

int calc(int u, int v) {
    return (power(u) + power(v) - 1) % MOD;
}

void solve() {
    int preans = 0;
    map < pr, pr > st;
    rep (i,n) {
        int a, b; scanf(II,&a,&b);
        if (b<0) { a=-a; b=-b; }
        if (a==0 && b==0) preans++;
        else {
            auto g=abs(gcd(abs(a), abs(b)));
            a/=g; b/=g;
            if (a<=0) ++st[pr(b,-a)].R;
            else      ++st[pr(a, b)].L;
        }
    }
    int res = 1;
    for (auto p : st) {
        auto t = p.R;
        (res *= calc(t.L , t.R)) %= MOD;
    }
    printf(IN,(res + preans - 1 + MOD) % MOD);
}


#ifdef ENABLE_LL
#undef int
#endif
int main(){
    init();
    solve();
    return 0;
}


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

#define     bip(a)         __builtin_popcount(a)
#define     ull            unsigned long long
#define     ll             long long
#define     u              unsigned
#define     pb             push_back
#define     pf             push_front
#define     mpr            make_pair
#define     ins            insert
#define     ff             first
#define     ss             second
#define     vi             vector<int>
#define     vl             vector<ll>
#define     si             set<int>
#define     sl             set<ll>
#define     li             list<int>
#define     pii            pair<int,int>
#define     pll            pair<ll,ll>
#define     mii            map<int,int>
#define     mll            map<ll,ll>
#define     ma             INT_MAX
#define     mi             INT_MIN
#define     mod            1000000007
#define     pi             3.14159265359
#define     e              2.71828182846
#define     inf            1000000000000000LL
#define     all(x)         x.begin(), x.end()
#define     lb(a,b,c)      lower_bound(a,a+b,c)-a
#define     ub(a,b,c)      upper_bound(a,a+b,c)-a
#define     lbv(a,c)       lower_bound(all(a),c)-a.begin()
#define     ubv(a,c)       upper_bound(all(a),c)-a.begin()
#define     srt1(a,b)      sort(a,a+b)
#define     srt2(a,b)      sort(a,a+b,greater<int>())
#define     gcd(a,b)       __gcd(a,b)
#define     lcm(a,b)       (a*(b/gcd(a,b)))
#define     harmonic(n)    0.57721566490153286l+log(n)
#define     mem(a, b)      memset(a, b, sizeof(a))

///s.lower_bound(a),s.upper_bound(a), for set
///nCr(x, y) = nCr(x-1, y-1) + nCr(x-1, y)
///factorial digit   ((n * log10(n / e) +log10(2 * pi * n) /2.0));
/// lcm(a,b)=a/gcd(a,b)*b (handle overflow)


bool sortinrev1(const pair<int,int>&a,const pair<int,int>&b)
{
    //return (a.first > b.first);
    if(a.first==b.first)return (a.second>b.second);
    else return (a.first > b.first);
}
bool sortinrev2(const pair<int,int>&a,const pair<int,int>&b)
{
    //return (a.first > b.first);
    if(a.first==b.first)return (a.second<b.second);
    else return (a.first > b.first);
}



int main()
{
    int n,a;
    cin>>n;
    a=n;
    n/=1000;
    //cout<<a<<endl;
    if(a%1000!=0)n+=1;
    int ans=(n*1000)-a;
    cout<<ans<<endl;
}



Measured memory_bytes: 3628
import sys
data = sys.stdin


conversion_data = []
for l in data:
    conversion_data.append(l.split())
    
S = list(conversion_data[0][0])
T = list(conversion_data[1][0])

cnt = 0
min = 0
for i in S:
  if i != T[cnt]:
    min += 1
  cnt += 1
  

print(min)

Measured memory_bytes: 12624
S = list(input())
small = [chr(i) for i in range(97,97+26)]
count = 0
ans = 'AC'
for i in range(len(S)):
    if i == 0:
        if S[i] != 'A':
            ans = 'WA'
            break
    elif i == 1:
        if S[i] not in small:
            ans = 'WA'
            break
    elif i != len(S)-1:
        if S[i] == 'C':
            count += 1
        elif S[i] not in small:
            ans = 'WA'
            break
    else:
        if S[i] not in small:
            ans = 'WA'
if ans == 'AC' and count != 1:
    ans = 'WA'
print(ans)


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

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

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

struct UnionFind {
  vector<int> par, s;
  UnionFind(int n=2e5) { init(n); }
  void init(int n) {
    s.assign(n, 1); par.resize(n);
    iota(par.begin(), par.end(), 0);
  }
  int find(int x) {
    if(par[x] == x) return x;
    return par[x] = find(par[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(s[x] < s[y]) par[x] = y, s[y] = s[x] + s[y];
    else par[y] = x, s[x] = s[x] + s[y];
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return s[find(x)]; }
};

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

  vector<ll> cnt(4);
  REP(i, 3) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    cnt[a]++;
    cnt[b]++;
  }

  sort(ALL(cnt));
  if(cnt[0] == 1 && cnt[1] == 1 && cnt[2] == 2 && cnt[3] == 2) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

#define AMAX 1e6

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

    priority_queue<int, vector<int>, greater<int>> q;
    for (int i = 0; i < N; i++)
    {
        int x;
        cin >> x;
        q.push(x);
    }

    vector<bool> used(AMAX + 1, false);
    int ans = 0;
    while (!q.empty())
    {
        int t = q.top();
        q.pop();

        //cout << t << endl;

        bool has_same = false;

        if (!q.empty() && t == q.top())
        {
            while (!q.empty() && t == q.top())
            {
                q.pop();
            }
            has_same = true;
        }

        if (!has_same && !used[t])
        {
            ans++;
        }

        for (int i = t; i <= AMAX; i += t)
        {
            used[i] = true;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3820
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"
#include <math.h>
int ans;
int i=0;
int main(int argc, char* argv[]){
  long int a=0,b=0,c=0;
  scanf("%ld",&a);
  if (a>=3) {
    for (i++; a != 4; i++) {
      if (a%2==0) {
        a/=2;
      }else{
        a=3*a+1;
      }
    }
    printf("%d",i+3);
  }else{
    printf("4");
  }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
    
#define all(a) a.begin(), a.end()
#define forn(l, r) for(int i = l; i < (r); ++i)
#define F first
#define S second
#define $ ios::sync_with_stdio(0);
//#define int long long int
    
using namespace std;
using namespace __gnu_pbds;
using ll = long long int;
using ii = pair<int, int>;
using vi = vector<int>;
using graph = vector<vi>;
using ordered_mset = tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update>;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
    
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    
const ll mod = 1000000007;
const int INF = 0x3f3f3f3f;
//const ll INFLL = (ll)1e17;
const int MAXN = 1123;
const double pi = 3.14159265359;
const double eps = 0.00000001;

char mat[MAXN][MAXN];
int dp[MAXN][MAXN];

int main() {
    int H, W;
    scanf("%d %d", &H, &W);
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            scanf(" %c", &mat[i][j]);
        }
    }
    for (int i = 0; i < H && mat[i][0] != '#'; ++i) {
        dp[i][0] = 1;
    }
    for (int j = 0; j < W && mat[0][j] != '#'; ++j) {
        dp[0][j] = 1;
    }
    for (int i = 1; i < H; ++i) {
        for (int j = 1; j < W; ++j) if (mat[i][j] != '#') {
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
        }
    }
    printf("%d\n", dp[H - 1][W - 1]);
}


Measured memory_bytes: 6400
#include <stdio.h>
#define N 100002

int main(void){
    long long int x,a,b;
    int m;
    long long int t;

    m=200;

    scanf("%lld", &x);

    for(a=-m;a<m;a++){for(b=-m;b<m;b++){
            t=a*a*a*a*a - b*b*b*b*b;
            if(t==x) goto flag;
        }}

    flag:
    printf("%lld %lld", a, b);

    return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define pb push_back
#define ins insert
#define ff first
#define ss second
#define Ln 20
#define mp make_pair
#define INF (ll)1e9+5
#define dif 0.0000000001
#define pp pair<ll,ll> 
#define sp set<pp>
#define vv vector< pair<ll ,ll> > 
#define vi vector<ll> 
#define SZ 100005
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

//vi adj[100005];

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

int main() {
    fastio;
    ll h,w,n,i,j,cur,st,k,f;
    ll a[10010];
    ll ans[105][105];
    cin>>h>>w;
    cin>>n;
    
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    
    st=1;
    k=0;
    cur=a[k];
   // cout<<cur<<'\n';
    f=0;
    
    for(i=0;i<h;i++)
    {
        if(st==1)
        {
            for(j=0;j<w;j++)
            {
                if(cur==0)
                {
                    k++;
                    if(k<n)
                        cur=a[k];
                    else
                    {
                        f++;
                        break;
                    }
                }
                
                //cout<<st<<' '<<j<<' '<<cur<<' '<<k<<'\n';
                ans[i][j]=k+1;
                cur--;
                
                
            }
            
            if(f==1)
             break;
            else
             st=2;
        }
        else
        {
            for(j=w-1;j>=0;j--)
            {
                if(cur==0)
                {
                    k++;
                    if(k<n)
                        cur=a[k];
                    else
                    {
                        f++;
                        break;
                    }
                }
                
                //cout<<st<<' '<<j<<' '<<cur<<' '<<k<<'\n';
                ans[i][j]=k+1;
                cur--;
                
            }
            
            if(f==1)
             break;
            else
             st=1;
        }
    }
    
    for(i=0;i<h;i++)
    {
        for(j=0;j<w;j++)
        {
            cout<<ans[i][j]<<' ';
        }
        cout<<'\n';
    }
    
    
   
    // your code goes here
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

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

int main() {
	
	ll x;
	cin >> x;
	
	cout << (ll)ceil((-1.0 + sqrt(1.0 + 8.0 * x)) / 2.0) << endl;

	return 0;
}

Measured memory_bytes: 256
// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimize("02")
#define F first
#define S second
#define pb push_back
#define all(x) x.begin() , x.end()
#define use_file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
using namespace std;
using ll = long long;
const ll N=3e7,inf=4e18;
ll n,a1,a2,b1,b2,c1,c2,dp[N][5];
int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	cin>>n;
	cin>>a1>>b1>>c1;
	cin>>a2>>b2>>c2;
	for(ll i=1;i<=n;i++){
		dp[i][0]=dp[i-1][4]+1;
		dp[i][4]=max(dp[i][0],dp[i][4]);
		if(i>=a1){
			dp[i][1]=dp[i-a1][4]+a2;
			dp[i][4]=max(dp[i][4],dp[i][1]);
		}
		if(i>=b1){
			dp[i][2]=dp[i-b1][4]+b2;
			dp[i][4]=max(dp[i][4],dp[i][2]);
		}
		if(i>=c1){
			dp[i][3]=dp[i-c1][4]+c2;
			dp[i][4]=max(dp[i][4],dp[i][3]);
		}
	}
	n=dp[n][4];
	swap(a1,a2);
	swap(b1,b2);
	swap(c1,c2);
	for(ll i=1;i<=n;i++){
		dp[i][0]=dp[i-1][4]+1;
		dp[i][4]=dp[i][0];
		if(i>=a1){
			dp[i][1]=dp[i-a1][4]+a2;
			dp[i][4]=max(dp[i][4],dp[i][1]);
		}
		if(i>=b1){
			dp[i][2]=dp[i-b1][4]+b2;
			dp[i][4]=max(dp[i][4],dp[i][2]);
		}
		if(i>=c1){
			dp[i][3]=dp[i-c1][4]+c2;
			dp[i][4]=max(dp[i][4],dp[i][3]);
		}
	}
	cout<<dp[n][4]<<endl;
}


Measured memory_bytes: 980112
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pi 3.141592653589793116
#define mod 1e9+7
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

long long int dp[100001][2];
int a[100001];
int n;
long long  go(int i,int curr)
{
   if(i==n-1)
     {
         if(curr==1)
           return -a[i];
         else
            return a[i];
     }
    if(dp[i][curr]!=LLONG_MIN)
       return dp[i][curr]; 
   else
      {   long long ans=0;
          if(curr==1)
             ans=max({ans,-a[i]+go(i+1,0),a[i]+go(i+1,1)});
          else
             ans=max({ans,a[i]+go(i+1,0),-a[i]+go(i+1,1)});
          dp[i][curr]=ans;
          return ans;       
      }
}


int main() {
  off;
  int t;
  //cin>>t;
  t=1;
  while(t--){  
     cin>>n;
     for(int i=0;i<n;i++)
        cin>>a[i];
      //memset(dp,-1,sizeof(dp));
    long long x=0;
    for(int i=0;i<2;i++)
    {
       for(int j=0;j<100001;j++)
          dp[j][i]=LLONG_MIN;
    }
    x=max(a[0]+go(1,0),-a[0]+go(1,1));
      cout<<x<<'\n';  
  }
    return 0;
}

Measured memory_bytes: 6912
S = input()
a = int(S[:2])
b = int(S[2:])

def isMM(num):
    return 1 <= num <= 12 

if isMM(a):
    if isMM(b):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if isMM(b):
        print('YYMM')
    else:
        print('NA')


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

int N, M;
int WA[105000];
bool AC[105000];

void solve() {
    cin >> N >> M;
    int WAnum = 0;
    int ACnum = 0;
    for(int i = 1; i <= N; i++) {
        WA[i] = 0;
        AC[i] = false;
    }
    while(M--) {
        int p;
        string S;
        cin >> p >> S;

        if(AC[p]==true) continue;

        if(S == "AC") {
            AC[p] = true;
            ACnum++;
            WAnum += WA[p];
        } else if(S == "WA") {
            WA[p]++;
        }
    }
    cout << ACnum << " " << WAnum << endl;
    return;
}

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


Measured memory_bytes: 768
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n+1) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    int a,b,k;
    cin >> a >> b >> k;
    if(a < k){
        k -= a;
        a = 0;
    }else return cout << a - k << ' ' << b << '\n',0;
    if(b < k){
        b = 0;
    }else b -= k;
    cout << a << ' ' << b << '\n';

	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; ++i)
    cin >> A[i];
  map<int, int> m;
  for (int i = 0; i < N; ++i)
    ++m[A[i]];
  for (int i = 0; i < N; ++i) {
    if (m[A[i]] >= 2) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

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

#define ll long long

using namespace std;

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

    ll q, x, p, o;
    set <ll> S;

    cin >> q;

    while(q--)
    {
        cin >> x >> p;

        if(x == 0)
        {
            S.insert(p);
            cout << S.size() << endl;
        }

        else if(x == 1)
            cout << (S.find(p) != S.end() ? 1 : 0) << endl;

        else if(x == 2)
            S.erase(p);

        else
        {
            cin >> o;
            auto it = S.lower_bound(p);

            for(; it != S.end() && *it <= o; it++)
                cout << *it << endl;
        }

    }

    return 0;
}


Measured memory_bytes: 12340
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main()
{    
    int n; cin >> n;
    ll sum=0;
    rep2(i,n){
        if(i%3==0 || i%5==0) continue;
        sum += i;
    }

    cout << sum << endl;

}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ code2.cpp
./a.out

サンプルのダウンロードは oj d URL
テストは oj t
*/


Measured memory_bytes: 3624
N=int(input())
P=tuple(map(int,input().split()))
Q=tuple(map(int,input().split()))
a=(i for i in range(1,N+1))
import itertools
A=list(itertools.permutations(a))
p,q=0,0
for i,x in enumerate(A):
    if P==x:
        p=i+1
    if Q==x:
        q=i+1
print(abs(p-q))

Measured memory_bytes: 8052
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
#include <functional>
#include <cstdlib>
//using
using namespace std;
using vl = vector <long long>;
using vs = vector <string>;
using vc = vector <char>;
using ll= long long;
using vvl = vector<vector<ll> >;
//vector<vector<char> > hyou(N, vector<char>(N));
using vd = vector <double>;
//define
//#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
#define print(n) cout<<n<<endl;
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
//素数判定　O(√A) 
bool is_prime(int x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }
/*順列生成
do {
  // 順列に対する処理
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/

//絶対値　abs()

//グローバル変数宣言
 ll p=0,q=0,r=0;

int main(){
  ll a,b,c,x;
  cin>>a>>b>>c>>x;
  x/=50;
  rep(i,a+1){
  if(i*10>x)break;
    rep(j,b+1){
    if(i*10+j*2>x)break;
      rep(k,c+1)
      if(i*10+j*2+k==x)p++;
    }
  }
  print(p)
}

Measured memory_bytes: 3588
z[999][999],d[999],n,m,a,b,i;
int D(c){
	if(d[c]>=0)return d[c];
	int i=0,x=0,y;
	for(;i<n;i++)if(z[i][c]){
		y=D(i)+z[i][c];
		if(x<y)x=y;
	}
	return d[c]=x;
}
main(x){
	for(scanf("%d%d",&n,&m);i<m;i++)scanf("%d%d%d",&a,&b,&x),z[a][b]=x;
	for(i=1;i<n;i++)d[i]=-1;
	printf("%d\n",D(n-1));exit(0);
}

Measured memory_bytes: 2160
def main():
    n = int(input())
    sum = 0
    for _ in range(0, n):
        x, y = (j for j in input().split())
        if(y[0] == 'B'):
            sum += float(x)*380000
        else:
            sum += int(x)
    print(sum)

if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int H,W,K;
  cin >> H >> W >> K;
  vector<string> A(H);
  REP(i, H) cin >> A[i];

  int cnt2 = 0;
  REP(i,1<<H){
    REP(j,1<<W){
      int cnt = 0;
      int y = i;
      REP(k,H){
        int x = j;
        REP(l,W){
          if(x%2==0&&y%2==0&&A.at(k).at(l)=='#'){
            cnt++;
          }
          x/=2;
        }
        y/=2;
      }
      if(cnt==K){
        cnt2++;
      }
    }
  }

  cout << cnt2 << endl;
}

Measured memory_bytes: 3568
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    cout << fixed << setprecision(10) << ceil(n / 2) / n << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#define REP(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;


int main(){

  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int s,g;
  s = max(a,c);
  g = min(b,d);
  cout<<max(0,g-s)<<endl;
  
  return 0;
}

Measured memory_bytes: 256
use std::collections::HashSet;
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let s: HashSet<char> = (0..n)
        .map(|_| read::<String>().chars().next().unwrap())
        .collect();
    println!("{}", if s.len() == 3 { "Three" } else { "Four" });
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    int ans=0;
    for(int i=1; i<=n; i++){
       string a=to_string(i);
       if(a.length()%2==1) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3784
import java.util.Scanner;


public class Main {

	static Scanner sc = new Scanner(System.in);
	
	static int day, m, d;
	static int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	static String week[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		while(read()){
			solve();
		}

	}
	
	static boolean read(){
		
		m = sc.nextInt();
		d = sc.nextInt();
		
		if(m == 0) return false;
		
		return true;
	}
	
	static void solve(){
		
		day = d;
		
		for(int i=1; i <= m-1; i++){
			day += month[i-1];
		}
		
		day %= 7;
		System.out.println(week[day]);
	}

}

Measured memory_bytes: 17196
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		System.out.print(s.charAt(0));
		System.out.print(s.length()-2);
		System.out.print(s.charAt(s.length()-1));

	}

}

Measured memory_bytes: 21076
#include <iostream>
using namespace std;
int main (void){
    int a;
    cin >> a;
    int h,m,s;
    h = a / 3600;
    a %=3600;
    m = a / 60;
    a %= 60;
    s = a;
    cout<< h <<":"<< m <<":"<< s <<endl;
    return 0;
}


Measured memory_bytes: 3116
#include<stdio.h>
int main(void)
{
	int n;
	int i[1001],p[1001],q[1001],r[1001],c[1001];
	int P,Q,R,C;
	int j,flg;
	
	scanf("%d",&n);
	while(n!=0){
		flg=0;
		for(j=0;j<n;j++){
			scanf("%d %d %d %d",&i[j],&p[j],&q[j],&r[j]);
			c[j]=p[j]*4+q[j]*9+r[j]*4;
		}
		scanf("%d %d %d %d",&P,&Q,&R,&C);
		for(j=0;j<n;j++){
			if(p[j]<=P && r[j]<=R && q[j]<=Q && c[j]<=C){
				printf("%d\n",i[j]);
				flg=1;
			}
		}
		if(flg==0){
			printf("NA\n");
		}
		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 632
S=list(input())
q=int(input())
Q=[input().split() for i in range(q)]

reverse=0
Top=[]
Bottom=[]
for i in range(q):
    if Q[i][0]=="1":
        reverse+=1
    elif Q[i][0]=="2" and reverse%2==0:
        if Q[i][1]=="1":
            Top.append(Q[i][2])
        elif Q[i][1]=="2":
            Bottom.append(Q[i][2])
    elif Q[i][0]=="2" and reverse%2==1:
        if Q[i][1]=="2":
            Top.append(Q[i][2])
        elif Q[i][1]=="1":
            Bottom.append(Q[i][2])
if reverse%2==1:
    Top.reverse()
    SS=Top+S+Bottom
    SS.reverse()
elif reverse%2==0:
    Top.reverse()
    SS=Top+S+Bottom
for i in SS:
    print(i,end="")

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

int main(void)
{
  int n, m;

  cin >> n >> m;

  int* a = new int[n];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }

  int num = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] * 4 * m >= sum) {
      num++;
    }
  }

  if (num >= m)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int a[32];

void aa(int x, int n, int t){
  int i;
  if(x < 0) return;
  //printf("x = %d  n = %d  t = %d\n", x, n, t);

  if(x == 0){
    printf("%d", a[0]);
    for(i = 1; i < n; i++) printf(" %d", a[i]);
    printf("\n");
    return;
  }

  for(i = t; i > 0; i--){
    a[n] = i;
    aa(x - i, n + 1, i);
    //printf("i = %d\n", i);
  }
}
main(){
    int n,i,j;
  while(1){
    scanf("%d",&n);
    if(n==0) break;
    aa(n, 0, n);

  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int K,T;
	cin >> K >> T;

	int a[T];
	int Max = 0;
	int before = -1;
	int current = -1;
	int result = 0;
	int b;
	bool newflag = false;
	for (int i = 0; i < T; ++i)
	{
		cin >> a[i];
		b = a[i];
		if(Max <= b){
			Max = a[i];
			current = i;
		}
	}
	a[current]--;
	before = current;
	Max=1;
	for (int j = 0; j < K-1; ++j)
	{
		for (int i = 0; i < T; ++i)
		{
			b =  a[i];
			if(Max <= b && i != before){
				Max = a[i];
				current = i;
				newflag = true;
			}
		}
		a[current]--;
		before = current;
		Max=1;
		if(newflag==false){
			result++;
		}
		newflag = false;
	}
	// 出力
	
	cout << result << endl;
	
	return 0;
}

Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
using namespace std;
const int INF=0x3f3f3f3f;
const int maxn=1e5+5;
int a[maxn],b[maxn];
int main()
{
    int A,B,M;
    scanf("%d%d%d",&A,&B,&M);
    int min_a=INF,min_b=INF;
    for(int i=1;i<=A;i++)
    {
        scanf("%d",&a[i]);
        min_a=min(min_a,a[i]);
    }
    for(int i=1;i<=B;i++)
    {
        scanf("%d",&b[i]);
        min_b=min(min_b,b[i]);
    }
    int ans=min_a+min_b;
    while(M--)
    {
        int u,v,w;
        scanf("%d%d%d",&u,&v,&w);
        ans=min(ans,a[u]+b[v]-w);
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// using cd = complex<double>;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
typedef long long int ll;
typedef long double ld;
const ll N = 2*1e5+9;
// const ll m = 1e9 + 7;
const ll inf= 1e14;
const ll mod =1e9+7;
const double PI = acos(-1);
// #define x first
// #define y second
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define pld pair<ld,ld>
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }

int main() {
    // ios::sync_with_stdio(false);
    // cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt","w",stderr); 
    #endif
    ll t = 1;
    // cin>>t;
    while(t--){
        ll n,d;cin>>n>>d;
        d = d*d;
        ll ans = 0;
        for(int i = 0;i<n;i++){
            ll x,y;cin>>x>>y;
            ll dis = x*x + y*y;
            if(dis<=d){
                ans++;
            }
        }
        cout<<ans<<'\n';
    }

        
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pai;
typedef pair<ll, ll> pal;
const int MOD = 1e9+7;
const ll LLINF = 1e18;


int main(){
	string a, b;
	cin >> a >> b;
	string s = a + b;
	for (int i = 1; i <= 1000; i++){
		if (i*i == stoi(s)){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}



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

using namespace std;

int main()
{
    double n,odd=0,result;

    cin>>n;

    for(int i=1;i<=n;i++)
    {
        if(i%2!=0)
        {
            odd++;
        }
    }

    result = odd/n;

    printf("%.10lf",result);

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			int a = sc.nextInt();
			if (n == 0 && m == 0 && a == 0)
				break;
			int[] amida = new int[n];
			for (int i = 0; i < n; i++)
				amida[i] = i;
			int[] h = new int[m];
			int[] p = new int[m];
			int[] q = new int[m];
			int max = 0;
			for (int i = 0; i < m; i++) {
				h[i] = sc.nextInt();
				p[i] = sc.nextInt();
				q[i] = sc.nextInt();
				max = Math.max(max, h[i]);
			}
			for (int i = max - 1; i >= 0; i--)
				for (int j = 0; j < m; j++)
					if (h[j] == i + 1) {
						int t = amida[p[j] - 1];
						amida[p[j] - 1] = amida[q[j] - 1];
						amida[q[j] - 1] = t;
					}
			for (int i = 0; i < n; i++)
				if (amida[i] == a - 1) {
					System.out.println(i + 1);
					break;
				}
		}
		sc.close();
	}
}

Measured memory_bytes: 62824
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

    public class Program
    {
        public static void Main(string[] args)
        {
            new B().test();
        }
    }
	public class B
	{
		public void test()
		{
			// 普通の文字列取得
			// 英語小文字のみ
			long input = CommonRead.ReadLong();

			var fiveHundred = 500;
			// 5はそのまま
			long five = 5;
			long returnValue = 0;
			long returnAmari = 0;

			// 500は二倍にする
			returnValue = Convert.ToInt32(Math.Floor((decimal)input / fiveHundred))  * 1000;
			returnAmari = input - Convert.ToInt32(Math.Floor((decimal)input / fiveHundred)) * 500 ;
			returnValue += Convert.ToInt32(Math.Floor((decimal)returnAmari / five)) *5;
			//出力
			Console.WriteLine(returnValue);
		}
	}

static class CommonRead
{
    public static string ReadStr()
    {
        return Console.ReadLine();
    }
    public static string[] ReadStrA()
    {
        return ReadStr().Split(' ');
    }
    public static List<string> ReadStrL()
    {
        return ReadStrA().ToList();
    }
    public static int ReadInt()
    {
        return Convert.ToInt32(ReadStr());
    }
    public static int[] ReadIntA()
    {
        return ReadStrA().Select(s => Convert.ToInt32(s)).ToArray();
    }
    public static List<int> ReadIntL()
    {
        return ReadStrA().Select(s => Convert.ToInt32(s)).ToList();
    }
    public static long ReadLong()
    {
        return Convert.ToInt64(ReadStr());
    }
    public static long[] ReadLongA()
    {
        return ReadStrA().Select(s => Convert.ToInt64(s)).ToArray();
    }
    public static List<long> ReadLongL()
    {
        return ReadStrA().Select(s => Convert.ToInt64(s)).ToList();
    }

    public static decimal ReadDecimal()
    {
        return Convert.ToDecimal(ReadStr());
    }
    public static decimal[] ReadDecimalA()
    {
        return ReadStrA().Select(s => Convert.ToDecimal(s)).ToArray();
    }
    public static List<decimal> ReadDecimalL()
    {
        return ReadStrA().Select(s => Convert.ToDecimal(s)).ToList();
    }

    public static double ReadDouble()
    {
        return Convert.ToDouble(ReadStr());
    }
    public static double[] ReadDoubleA()
    {
        return ReadStrA().Select(s => Convert.ToDouble(s)).ToArray();
    }
    public static List<double> ReadDoubleL()
    {
        return ReadStrA().Select(s => Convert.ToDouble(s)).ToList();
    }

}


Measured memory_bytes: 11220
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <vector>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n - 1); i >= 0; --i)
#define mod 100000
#define INF 93193111451418101
#define MIN -933111451418101
#define pb push_back
using namespace std;
typedef pair<ll, ll> P;

/*template <typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T &arr, const U &v) {
arr = v;
}
template <typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR &arr, const U &v) {
for (auto &i : arr) {
fill_all(i, v);
}
}*/
//------------------?????°-----------------------//
ll n, l;
vector<ll>v, sa;
//-------------------??¢??°----------------------//

int main() {
	cin >> n >> l;
	ll mae = -INF,itr,flag=0;
	REP(i, n) {
		ll hoge; cin >> hoge; if (mae + hoge >= l) { flag = 1; itr = i-1 ; break; }
		mae = hoge;
	}
	if (!flag) { cout << "Impossible" << endl; return 0; }
	cout << "Possible" << endl;
	REP(i, itr) {
		cout << i + 1 << endl;
	}
	for (ll i = n-1; i >itr; i--)
	{
		cout << i << endl;
	}
	return 0;
}



Measured memory_bytes: 768
//### In The Name Of GOD ###

// %% Remember; (((He))) is The (((Accepter))) %%

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;

#define int ll
#define pb push_back
#define bp pop_back
#define pf push_front
#define fp pop_front
#define X first
#define Y second
#define IO ios_base::sync_with_stdio(false);
#define sz(a) (int)(a.size())
#define sg(a, b) (a + b - 1) / b

const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 2 * 1000 * 1000 + 200;
const int MAXN = 100 * 1000 + 1;
const int MLOG = 18;
const int NMAX = 1 * 1000;

signed main(){
  IO;
  string s;
  cin >> s;
  int ans = 0;
  for(int i = 1; i < sz(s); i++){
    ans += (s[i] != s[i - 1]);
  }
  cout << ans;
}


Measured memory_bytes: 512
/**
 * Title: A - The Number of Even Pairs / 
 * Url: https://atcoder.jp/contests/abc159/tasks/abc159_a
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main() {
    int n, m; cin >> n >> m;
    int odd = 0, even = 0;
    if(n>1) even = n * (n-1) * 0.5;
    if(m>1) odd = m * (m-1) * 0.5;
    cout << even + odd << endl;
    return 0;
}

Measured memory_bytes: 256
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const input = Number(lines.shift());

  const amari = input % 10;

  if (amari === 3) {
    console.log("bon");
  } else if (amari === 0 || amari === 1 || amari === 6 || amari === 8) {
    console.log("pon");
  } else {
    console.log("hon");
  }
});


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

int main() {

    long long int n;
    cin >> n;

    vector< long long int > v;

    for ( long long int i = 0; i < n; i++ ) {

        long long int in;
        cin >> in;

        /*
        if ( v.size() == 0 ) {
            v.push_back( in );
            continue;
        }
        */

        decltype(v)::iterator it = std::upper_bound( v.begin(), v.end(), -in );
        if ( it != v.end() ) {
            *it = -in;
        } else {
            v.insert( v.end(), -in );
        }

    }

    cout << v.size() << endl;

    return 0;

}


Measured memory_bytes: 1400
#include <stdio.h>

int main() {
	int a[5]={0}, b[5]={0}, i, j, gn;
	// Input Five Number
	scanf("%d %d %d %d %d",&a[0] ,&a[1] ,&a[2] ,&a[3] ,&a[4]);
	for(i=0;i<5;i++) {
		gn = 0;
		b[i] = -32768;
		for(j=0;j<5;j++) {
			// If I find larger number, input it to b[i]
			if (b[i]<a[j]) {
				b[i] = a[j];
				gn = j;
			}
		}
		// Delete a[gn]
		a[gn] = -32768;
	}
	printf("%d %d %d %d %d\n",b[0] ,b[1] ,b[2] ,b[3] ,b[4]);
	return 0;
}

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

int main() {
  int N, D;
  cin >> N >> D;
  vector<vector<double>> vec(N,vector<double>(D));
  for(int i=0; i<N; i++){
    for(int j=0; j<D; j++){
      cin >> vec.at(i).at(j);
    }
  }
  int count = 0;
  for(int k=0; k<N; k++){
    for(int l=k+1; l<N; l++){
      double ans = 0;
      for(int m=0; m<D; m++){
        ans += (vec.at(k).at(m) - vec.at(l).at(m)) *(vec.at(k).at(m) - vec.at(l).at(m));
      }
      ans = pow(ans,0.5);
      int ans_x = ans;
      if(ans == ans_x){
        count++;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 384
n = input()
ds = []
s = 0
f = 0
for i in range(int(n)):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        s += 1
    else:
        s = 0

    if s == 3:
        f = 1

if f == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9176
#include<stdio.h>
int main()
{
  int W,H,x,y,r;
  scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
   if(x >= r && y >= r && H >= y+r && W >= x+r) 
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}



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

static const int MAX = 1e5;
int p[MAX], q[MAX], r[MAX];

int main(){
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	for(int i = 0; i < a; i++){
		scanf("%d", &p[i]);
	}
	for(int i = 0; i < b; i++){
		scanf("%d", &q[i]);
	}
	for(int i = 0; i < c; i++){
		scanf("%d", &r[i]);
	}
	ll ans = 0;
	sort(p, p + a);
	reverse(p, p + a);
	sort(q, q + b);
	reverse(q, q + b);
	sort(r, r + c);
	reverse(r, r + c);
	vector<int> vec;
	for(int i = 0; i < x; i++){
		vec.push_back(p[i]);
	}
	for(int i = 0; i < y; i++){
		vec.push_back(q[i]);
	}
	for(int i = 0; i < c; i++){
		vec.push_back(r[i]);
	}
	sort(vec.begin(), vec.end());
	reverse(vec.begin(), vec.end());
	for(int i = 0; i < x + y; i++){
		ans += vec[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3572