akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;



int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int a, b;
	cin >> a >> b;
	if (a <= 9 && b <= 9)
		cout << a * b;
	else
		cout << -1;
	
	return 0;
}

Measured memory_bytes: 256
// D.

#include <iostream>
#include <algorithm>
#include <numeric>
#include <cstring>

using namespace std;

int main(int argc, char *argv[])
{
	int n, m, r, a, b, c, d[200][200];
	cin >> n >> m >> r;
	int vis[8];
	for (int i = 0; i < r; ++i) {
		cin >> vis[i];
		--vis[i];
	}
	sort(vis, vis + r);
	memset(d, 0x3f, sizeof(d));
	for (int i = 0; i < m; ++i) {
		cin >> a >> b >> c;
		d[a-1][b-1] = d[b-1][a-1] = c;
	}
	for (int k = 0; k < n; ++k) {
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	int ans = 1<<30;
	do {
		int cost = 0;
		for (int i = 1; i < r; ++i) {
			cost += d[vis[i-1]][vis[i]];
		}
		ans = min(ans, cost);
	} while (next_permutation(vis, vis + r));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=(a); i<(b); i++)
#define per(i,a,b) for(ll i=(a)-1; i>=(b); i--)
ll n;
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>n;
    ll yen500=n/500;
    ll yen5=n%500/5;
    cout<<yen500*1000+yen5*5<<"\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#define EPS 1e-13
using namespace std;
const int MAXN = 1005;
struct Node{
	int x;
	double v;
	bool operator < (const Node &b)const
	{
		return v-b.v>EPS;
	}
};
int n;
struct Edge{
	int to,next;
	double w;
}e[(MAXN*MAXN)<<1];
int head[MAXN];
long long x[MAXN],y[MAXN],r[MAXN];
int s,t;
inline double dis(int i,int j)
{
	return max(sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))-r[i]-r[j],(double)0);
}
int cnt;
inline void insert(int u,int v,double w)
{
	e[++cnt].to=v,e[cnt].next=head[u],head[u]=cnt,e[cnt].w=w;
}
priority_queue<Node>q;
int vis[MAXN];
double d[MAXN];
inline void dij()
{
	for(int i=1;i<=1002;++i)d[i]=100000000000000;
	memset(vis,0,sizeof(vis));
	q.push((Node){s,0});
	d[s]=0;
	while(!q.empty()){
		int u=q.top().x;q.pop();
		if(vis[u])continue;
		vis[u]=true;
		for(int i=head[u];i;i=e[i].next){
			int v=e[i].to;
			if(d[v]-d[u]-e[i].w>EPS){
				d[v]=d[u]+e[i].w;
				q.push((Node){v,d[v]});
			}
		}
	}
	printf("%.10lf\n",d[t]);
}
int main()
{
	s=1001,t=1002;
	scanf("%lld%lld%lld%lld",x+s,y+s,x+t,y+t);
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%lld%lld%lld",x+i,y+i,r+i);
	}
	for(int i=1;i<=1002;++i){
		for(int j=1;j<=1002;++j){
			if(i!=j)insert(i,j,dis(i,j));
		}
	}
	dij();
	return 0;
}

Measured memory_bytes: 22768
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	int H1, M1, H2, M2, K;
	cin >> H1 >> M1 >> H2 >> M2 >> K;

	int diff = H2 * 60 + M2 - (H1 * 60 + M1);

	int ans = max(0, diff - K);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define fop(i,m,n) for(ll i=m;i<n;i++)
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
using namespace std;
int main(){
	ll n;
	cin >> n;
	ll dp[n][n];
	ll a[n];
	fop(i,0,n){
		cin >> a[i];
		dp[i][i] = a[i];
	}
	fop(i,1,n){
		for(ll l=0,r;(r = l + i) < n;l++){
			dp[l][r] = max(a[l] - dp[l+1][r] ,a[r] - dp[l][r-1]);
		}
	}
	cout << dp[0][n-1];
}

Measured memory_bytes: 70528
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define fore(i,a,b) for(int i=a,thxicesi=b; i<thxicesi;i++)
#define FIN ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0)
#define sz(s) int(s.size())
using namespace std;

int main()
{FIN;
    int n,k; cin>>n>>k;
    vector<int> snukes(n);
    fore(i,0,k){
        int d; cin>>d;
        fore(j,0,d){
            int s; cin>>s;
            snukes[s-1]++;
        }
    }
    int cnt = 0;
    fore(i,0,n){
        if(snukes[i]== 0) cnt++;
    }
    cout<<cnt<<"\n";
    return 0;

}


Measured memory_bytes: 3668
N=int(input())
A=list(map(int,input().split()))
answer=0
if 0 in A:
    for a in A:
        answer+=abs(a)
    print(answer)
else:
    minus=0
    plus=0
    for a in A:
        if a<0:
            minus+=1
        else:
            plus+=1
    if minus%2==0:
        for a in A:
            answer+=abs(a)
        print(answer)
    else:
        B=[]
        for a in A:
            B.append(abs(a))
        place=B.index(min(B))
        for n in range(N):
            if n==place:
                answer-=abs(A[n])
            else:
                answer+=abs(A[n])
        print(answer)
        

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

int main()
{
    int N;
    int size = 0;
    int count = 0;
    cin >> N;
    vector<int> list(N);
    for (int i = 0;i<N;i++)
        cin >> list.at(i);
    
    sort(list.begin(), list.end());

    for(int i=0;i<N;i++){
        if(size!=list.at(i)){
            count++;
            size = list.at(i);
        }
    }

    cout << count;

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int n=100050;

vector<bool> isp(n + 1, true);


void sieve() {
    isp[0] = false;
    isp[1] = false;
    for (int i = 2; i*i <= n; i++) {
        if (isp[i]) for (int j = 2; i * j <= n; j++) isp[i * j] = false;
    }
}


int main() {
    sieve();
    int q;
    cin >> q;
    vector<int> r(100010);
    r[0]=0;
    for (int i = 1; i <= 100005; i++) {
        if (isp[i]&&isp[(i+1)/2]) {
            r[i] = r[i - 1] + 1;
        }else r[i]=r[i-1];
    }
    vector<int> L(q), R(q);
    rep(i, q) cin >> L[i] >> R[i];
    rep(i, q) {
        cout << r[R[i]] - r[L[i] - 1] << endl;
    }
}

Measured memory_bytes: 1792
package main

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

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var n int
	fmt.Fscan(read, &n)

	ans := 0.0
	for i := 0; i < n; i++ {
		var a int64
		fmt.Fscan(read, &a)
		ans += float64(1) / float64(a)
	}
	fmt.Fprintln(write, 1/ans)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
//*******************
// Mahmoud Magdy    *
//*******************
#define ll long long
#define endl "\n"

void fast()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
inline int D()
{
    int m ;
    cin>>m;
    return m ;
}
inline ll lD()
{
    ll m ;
    cin>>m;
    return m ;
}
inline double dD()
{
    double m ;
    cin>>m;
    return m ;
}
int main()
{
fast();
int t=D();
int n=t;
ll sum=0;
while(t){
    sum+=t%10;
    t/=10;
}
if(n%sum==0)
    cout<<"Yes"<<endl;
else
    cout<<"No"<<endl;
}



Measured memory_bytes: 256
include Math

Point = Struct.new(:x, :y) do
  def to_s
    '%.8f %.8f' % [x, y]
  end
end

def koch(n, p1, p2)
  return if n == 0

  s_x = (2 * p1.x + 1 * p2.x) / 3.0
  s_y = (2 * p1.y + 1 * p2.y) / 3.0

  s = Point.new(s_x, s_y)

  t_x = (1 * p1.x + 2 * p2.x) / 3.0
  t_y = (1 * p1.y + 2 * p2.y) / 3.0

  t = Point.new(t_x, t_y)

  th = PI * 60.0 / 180.0

  u_x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x
  u_y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y

  u = Point.new(u_x, u_y)

  koch(n - 1, p1, s)
  puts s
  koch(n - 1, s, u)
  puts u
  koch(n - 1, u, t)
  puts t
  koch(n - 1, t, p2)
end

n = gets.to_i

p1 = Point.new(0.0, 0.0)
p2 = Point.new(100.0, 0.0)

puts p1
koch(n, p1, p2)
puts p2

Measured memory_bytes: 8988
from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

n = int(input())
s = input()
ans = 0
for i in range(1,n):
    cnt = 0
    c1 = Counter(s[:i])
    c2 = Counter(s[i:])
    for x in c1.keys():
        if c2[x]: cnt+=1
    ans = max(cnt, ans)
print(ans)

Measured memory_bytes: 10468
#include<iostream>
#include<set>
#include<queue>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef pair<int,int> pii;

set<pii> bus_time;

int main(){
  int n,m;
  cin >> n;
  for (int i = 0; i < n; i++){
    int h,m;
    cin >> h >> m;
    bus_time.insert(pii(h,m));
  }
  cin >> m;
  for (int i = 0; i < m; i++){
    int h,m;
    cin >> h >> m;
    bus_time.insert(pii(h,m));
  }
  int count = 0;
  for(pii point:bus_time){
    count++;
    printf("%d:%02d", point.first, point.second);
    if(count != bus_time.size())
      printf(" ");
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 1224
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);



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

	int N, L;
	cin >> N >> L;
	vector<string>S(N);
	rep(i, N)cin >> S[i];
	sort(ALL(S));
	rep(i, N)cout << S[i];
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
ll fac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
    ll n,m;cin >> n >>m;
    priority_queue<ll,vl,less<ll>> que;
    rep(i,n){
        ll a;cin >> a;
        que.push(a);
    }
    rep(i,m){
        ll x=que.top();
        que.pop();
        que.push(x/2);
    }
    ll ans=0;
    rep(i,n){
        ans+=que.top();
        que.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
// 16:22 -
#include <iostream>

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

int main() {
  std::string s;
  std::cin >> s;

  bool isGood = true;
  for (int i = 0; i < s.length() - 1; ++i) {
    if (s[i] == s[i + 1]) isGood = false;
  }

  std::cout << (isGood ? "Good" : "Bad") << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int a[110];
  int counter=1;
  cin >> N;

  for(int i = 0;i<N;++i)cin >>a[i];
  sort(a,a+N ,greater<int>());
  for(int i = 0;i<N-1;++i){
    if(a[i]-a[i+1]!=0) counter+=1;
  }
  cout <<counter<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int main(void)
{
    char s[200];
    while (scanf("%s", s), *s-'#') {
        int i, d=1<<21, n=0, x=d, g;
        for(i=strlen(s)-1;i>=0;i-=4+(s[i]=='h')) {
            if (s[i]=='h')
                n=n<x?0:n-x;
            else
                n=n+x>d?d:n+x;
            x/=2;
        }
        n*=90;
        g=gcd(d, n);
        n/=g, d/=g;
        printf("%d", n);
        if (d>1) printf("/%d", d);
        puts("");
    }
    return 0;
}

Measured memory_bytes: 548
#include<iostream>
using namespace std;
#define MAX 1000
#define LIMIT 13

bool state[MAX+1];
int ans[MAX+1];
int target;

void dfs(int depth, int pre, int maxv ){
  if ( pre == target ){
    ans[target] = min( ans[target], depth );
    return;
  }
  if ( depth >= ans[target] ) return;

  int next, d = 0, p = maxv;

  while( p < target ){d++; p *= 2;}
  if ( depth + d >= ans[target] ) return;

  for ( int i = 1; i <= maxv; i++ ){
    if ( !state[i] ) continue;

    next = pre + i;
    if ( next <= MAX && !state[next] ){
      state[next] = true;
      dfs(depth+1, next, max(maxv, next));
      state[next] = false;
    }

    next = ( pre > i ) ? ( pre - i ) : (i - pre);
    if ( !state[next] ){
      state[next] = true;
      dfs(depth+1, next, max(maxv, next));
      state[next] = false;
    }
  }
}

main(){
  for ( int i = 0; i <= MAX+1; i++ ) ans[i] = LIMIT;
  while(cin >> target && target){
    for ( int i = 0; i <= MAX+1; i++ ) state[i] = false;
    state[1] = true;
    dfs(0, 1, 1);
    cout << ans[target] << endl;
  }
}

Measured memory_bytes: 872
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
ll power(ll i, ll j); 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitcount(n) __builtin_popcountll(n)
#define in_edges(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B);}
#define in_edges3(M) repp(I, 1, M){int A, B, C; cin >> A >> B >> C; v[A].pb(B, C), v[B].pb(A, C);}
#define endl "\n"

const ll MOD = 1000000007;
const ll INF = 1e18;
const int N = 1e3 + 3;
const int inf = 1e8;

int n, m;
int sx, sy;
int ex, ey;
int dp[N][N];
char mat[N][N];

void bfs(){
    deque<pair<int, int> > q;
    q.push_back(MP(sx, sy));
    dp[sx][sy] = 0;

    while(q.size()){
        auto p = q.front();
        q.pop_front();
        auto i = p.ff;
        auto j = p.ss;

        int nx[] = {i + 1, i - 1, i, i};
        int ny[] = {j, j, j + 1, j - 1};

        rep(k, 0, 4){
            int x = nx[k], y = ny[k];
            if(x < 1 || x > n || y < 1 || y > m) continue;
            if(mat[x][y] == '#') continue;
            if(dp[x][y] <= dp[i][j]) continue;
            dp[x][y] = dp[i][j];
            q.push_front(MP(x, y));
        }

        repp(dx, -2, 2){
            repp(dy, -2, 2){
                int x = i + dx;
                int y = j + dy;
                if(x < 1 || x > n || y < 1 || y > m) continue;
                if(mat[x][y] == '#') continue;
                if(dp[x][y] <= dp[i][j] + 1) continue;
                dp[x][y] = dp[i][j] + 1;
                q.push_back(MP(x, y));
            }
        }
    }
}

int main() //PointBlank's code ¯\_(ツ)_/¯
{
    quickio
    rep(i, 0, N) rep(j, 0, N) mat[i][j] = '#', dp[i][j] = inf;

    cin >> n >> m;
    cin >> sx >> sy;
    cin >> ex >> ey;
    repp(i, 1, n) repp(j, 1, m) cin >> mat[i][j];

    bfs();
    rep(i, 0, N) rep(j, 0, N) if(dp[i][j] == inf) dp[i][j] = -1;

    cout << dp[ex][ey];
}

ll power(ll i, ll j)
{ 
    ll res = 1; i %= MOD;
    while(j > 0){if(j & 1) res = (res*i) % MOD; j = j>>1, i = (i*i) % MOD;} 
    return res; 
}


Measured memory_bytes: 8576
#include<stdio.h>

void main(){
  char day[4];
  scanf("%s",&day);
  if (day[0]=='S'&&day[1]=='U'){
    printf("%d",7);
  }
  else if(day[0]=='M'){
	printf("%d",6);
  }
  else if(day[0]=='T'&&day[1]=='U'){
	printf("%d",5);
  }
  else if(day[0]=='W'){
	printf("%d",4);
  }
  else if(day[0]=='T'&&day[1]=='H'){
	printf("%d",3);
  }
  else if(day[0]=='F'){
	printf("%d",2);
  }
  else if(day[0]=='S'&&day[1]=='A'){
	printf("%d",1);
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <set>
using namespace std;

int n;
string a, b;
set<string> st;
int main() {
	cin >> n >> b;
	st.insert(b);
	while(--n) {
		cin >> a;
		if(st.count(a) || a[0]!=b[b.size()-1]) {puts("No"); return 0;}
		st.insert(a);
		b = a;
	}
	puts("Yes");
	return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long


const int Mod = 1e9+7;

int n, k;
int a[101];
int dp[101][100001];


int32_t main()
{
      IOS;

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

      for(int i=0; i<=a[0]; i++)
      	dp[0][i] = 1;

      for(int i=1; i<n; i++)
      {
      	vector<int> pref(k+1); //dp prefix sum optimization technique
      	pref[0] = dp[i-1][0];
      	for(int j=1; j<=k; j++)
      		pref[j] = (pref[j-1] + dp[i-1][j]) % Mod;

      	for(int j=0; j<=k; j++)
      	{
      		if(j-a[i]>0) dp[i][j] = (pref[j]-pref[j-a[i]-1] + Mod) % Mod;
      		else dp[i][j] = pref[j];
      	}
      }

      int ans= dp[n-1][k];

      cout<<ans;



      return 0;
}


Measured memory_bytes: 82404
#include <bits/stdc++.h>
using namespace std;
typedef bool boolean;

const int N = 3005;

int n, L;
int a[N];

int main() {
	scanf("%d%d", &n, &L);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
	}
	long double pi = acos(-1);
	long double Ex = 0, Ey = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			int cnt1 = j - i - 1, cnt2 = n - 2 - cnt1;
			long double theta = ((a[i] + a[j]) * pi / L);
			Ex += cos(theta) * (cnt2 - cnt1);
			Ey += sin(theta) * (cnt2 - cnt1);
		}
	}
	long long cnt = 1ll * n * (n - 1) * (n - 2) / 6;
	Ex /= cnt, Ey /= cnt;
	printf("%.12lf %.12lf\n", (double) Ex, (double) Ey);
	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void){
    int a,b;
    scanf("%d%d",&a,&b);
    int y=0;

    for(int i=0;i<2;i++){
        if(a<b){
            y+=b;
            b-=1;
        }else{
            y+=a;
            a-=1;
        }
    }
    printf("%d",y);
    return 0;

}

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

int main() {
  int N, A;
  cin >> N >> A;
  
  if (N % 500 == 0 || N % 500 <= A) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3552
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Collection;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Deque;
import java.util.LinkedList;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class ADarkerAndDarker {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int H = in.ni(), W = in.ni();
            char[][] grid = new char[H][];
            for (int i = 0; i < H; i++) {
                grid[i] = in.ns().toCharArray();
            }
            Deque<Pos> dq = new LinkedList<>();
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    if (grid[i][j] == '#') {
                        dq.offer(new Pos(i, j, 0));
                    }
                }
            }
            int[] dx = new int[]{1, -1, 0, 0};
            int[] dy = new int[]{0, 0, 1, -1};
            int ans = 0;
            while (!dq.isEmpty()) {
                Pos pos = dq.poll();
                for (int i = 0; i < 4; i++) {
                    int rr = pos.r + dx[i];
                    int cc = pos.c + dy[i];
                    if (rr >= 0 && rr < H && cc >= 0 && cc < W && grid[rr][cc] == '.') {
                        grid[rr][cc] = '#';
                        dq.offer(new Pos(rr, cc, pos.d + 1));
                    }
                }
                ans = pos.d;
            }
            out.println(ans);


        }

        class Pos {
            int r;
            int c;
            int d;

            public Pos(int r, int c, int d) {
                this.r = r;
                this.c = c;
                this.d = d;
            }

        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

    }
}



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

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())

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

const int MAXN = 2e5 + 5;

int dp[MAXN];

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

  int n; cin >> n;

  REP(i, n) {
    int x; cin >> x;
    dp[x] = dp[x - 1] + 1;
  }

  int sol = n;
  FOR(i, 1, n + 1) {
    sol = min(sol, n - dp[i]);
  }

  cout << sol;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;
const long double PI=3.14159265358979;

vector<ll> Dijkstra(vector<vector<pair<ll,ll>>> x,ll y){
  priority_queue<pair<ll,ll>, vector<pair<ll,ll>>, greater<pair<ll,ll>>> q;
  pair<ll,ll> p={0,y};
  q.push(p);
  vector<ll> ans(x.size(),MOD);
  while(!q.empty()){
    pair<ll,ll> fe=q.top();
    q.pop();
   // cout<<fe.first<<" "<<fe.second<<endl;
    if(fe.first>ans[fe.second]){
      continue;
    }
    ans[fe.second]=fe.first;
    for(int i=0;i<x[fe.second].size();i++){
      pair<ll,ll> le=x[fe.second][i];
      if(fe.first+le.first<ans[le.second]){
        ans[le.second]=fe.first+le.first;
        le.first=ans[le.second];
        q.push(le);
      }
    }
  }
  return ans;
}

  


int main() {
  ll V,E,r;
  cin>>V>>E>>r;
  vector<vector<pair<ll,ll>>> G(V,vector<pair<ll,ll>>(0));
  for(int i=0;i<E;i++){
    ll a,b,c;
    cin>>a>>b>>c;
    pair<ll,ll> P={c,b};
    G[a].push_back(P);
  }
  vector<ll> ans=Dijkstra(G,r);
  for(int i=0;i<ans.size();i++){
    if(ans[i]==MOD){
      cout<<"INF"<<endl;
      continue;
    }
    cout<<ans[i]<<endl;
  }
 // cout<<G[2][0].second;
}


Measured memory_bytes: 30796
import java.io.*;
class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r =
            new BufferedReader(new InputStreamReader(System.in), 1);
        String is = r.readLine();
        if(!is.contains(" "))
        	return;
        String[] sp = is.split(" ");
        int a = Integer.parseInt(sp[0]);
        int b = Integer.parseInt(sp[1]);
        int area = a*b;
        int round = a*2+b*2;
        System.out.println(area + " " + round);
    }
}

Measured memory_bytes: 24284
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(lo i=0;i<n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 4005;
const lo mod = 1000000007;

lo n,m,b[li],a[li],k,flag,dp[li];
lo cev;
string s;
vector<int> v;

inline lo add(lo x,lo y){
	if(x+y>=mod)return x+y-mod;
	return x+y;
}

int main(void){
	scanf("%lld %lld",&n,&m);
	FOR{
		scanf("%lld",&a[i]);
	}
	for(lo i=0;i<m;i++){
		scanf("%lld",&b[i]);
	}
	for(lo i=0;i<=n+m+1;i++){
		dp[i]=1;
	}
	for(lo i=n;i>=1;i--){
		for(lo j=i;j<m+i;j++){
			if ((i & 7) || (j & 7)) {
				if(a[n-i]==b[j-i]){
					dp[j]=(add(dp[j-1],dp[j+1]))%mod;
				}
				else{
					dp[j]=(add(dp[j-1],dp[j+1])-dp[j])%mod;
				}
			}
			else{
				if(a[n-i]==b[j-i]){
					dp[j]=((dp[j-1]+dp[j+1]));
				}
				else{
					dp[j]=(dp[j-1]+dp[j+1]-dp[j]);
				}
			}
		}
	}
	printf("%lld\n",(dp[m]%mod+mod)%mod);
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <iostream>
#include <vector>
#include <string>
#include <array>
#include <set>
#include <map>
#include <cmath>

using namespace std;

array<vector<vector<int>>, 2> arr, pref;
int ans;

inline int calc(vector<vector<int>>& pref, int x1, int y1, int x2, int y2) {
    //if (x1 > x2 || y1 > y2) return 0;
    int ans = pref[x2][y2] - pref[x1 - 1][y2] - pref[x2][y1 - 1] + pref[x1 - 1][y1 - 1]; /// ?
    return ans;
}

int sz;
/*
inline int fix(int t, int x1, int y1, int x2, int y2) {
    return calc(pref[t], x1, y1, x2, y2) - calc(pref[(t + 1) % 2], x1, y1, x2, y2);
}*/

int main() {
    int N, K;
    cin >> N >> K;
    sz = K * 2;
    arr[0].resize(sz + 1, vector<int>(sz + 1));
    pref[0].resize(sz + 1, vector<int>(sz + 1));
    arr[1].resize(sz + 1, vector<int>(sz + 1));
    pref[1].resize(sz + 1, vector<int>(sz + 1));
    for (int i = 0; i < N; i++) {
        int x, y;
        string t;
        cin >> x >> y >> t;
        x %= sz;
        y %= sz;
        x++, y++;
        if (t == "B") {
            arr[0][x][y]++;
        } else arr[1][x][y]++;
    }
    for (int t = 0; t <= 1; t++)
        for (int i = 1; i <= sz; i++) {
        for (int j = 1; j <= sz; j++) {
            pref[t][i][j] = pref[t][i][j - 1] + pref[t][i - 1][j] - pref[t][i - 1][j - 1] + arr[t][i][j];
        }
    }
    //cout << "! " << endl;
    /*for (int i = 0; i < arr[0].size(); i++) {
        for (auto el: arr[0][i]) cout << el << " ";
        cout << endl;
    }
    cout << endl;
    for (int i = 0; i < arr[1].size(); i++) {
        for (auto el: arr[1][i]) cout << el << " ";
        cout << endl;
    }*/

    for (int t = 0; t <= 1; t++) {
        for (int i = 1; i <= sz; i++) {
            for (int j = 1; j <= sz; j++) {
                //cout << "@ " << t << " " << i << " " << j << endl;
                int curr = calc(pref[(t + 1) % 2], 1, 1, sz, sz);
                //vector<array<int, 2>> pass;
                int Q = 3;
                for (int q1 = -Q; q1 <= Q; q1++) {
                    for (int q2 = -Q; q2 <= Q; q2++) {
                        if ((q1 + q2) % 2 == 0) {
                            int x2 = i + K * q1, y2 = j + K * q2;
                            int x1 = x2 - K + 1, y1 = y2 - K + 1;
                            if (x1 > sz || y1 > sz) continue;
                            if (x2 < 1 || y2 < 1) continue;
                            x2 = min(x2, sz);
                            y2 = min(y2, sz);
                            x1 = max(x1, 1);
                            y1 = max(y1, 1);
                            //" " <<  calc(pref[(t + 1) % 2], x1, y1, x2, y2) << endl;
                            curr += calc(pref[t], x1, y1, x2, y2) - calc(pref[(t + 1) % 2], x1, y1, x2, y2);
                            //pass.push_back({i + K * q1, j + K * q2});
                        }
                    }
                }
                ans = max(ans, curr);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 65152
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
typedef long long int ll;

// void solve(ll K, ll A, ll B);

// vector<ll> dp(1000000000 + 1);

int main()
{
    ll A, B;
    cin >> A >> B;

    if(B%A==0)
        cout <<A+B<<endl;
    else
    {
        cout<< B-A<<endl;
    }
    
   
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  string ans;
  if (a + b > c + d) {
    ans = "Left";
  } else if (a + b == c + d) {
    ans = "Balanced";
  } else {
    ans = "Right";
  }
  cout << ans << endl;
}

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

using namespace std;

//#define FILE_IO

typedef pair<int, int> pii;

int N;
int ans[250005];
int f[505];
vector <pii> v;
vector <int> rem;

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d", &N);
    for(int i = 1; i <= N; i++)
    {
        int p;
        scanf("%d", &p);
        v.push_back({p, i});
        f[i] = p;
        ans[p] = i;
    }
    sort(v.begin(), v.end());

    int pos = 1;
    for(int i = 0; i < v.size(); i++)
    {
        int p = v[i].first;
        int val = v[i].second;
        int lft = val - 1;
        int rgt = N - val;
        for(; pos < p && lft; pos++)
        {
            if(ans[pos])    continue;
            ans[pos] = val;
            lft--;
        }
        if(pos == p && lft)    { printf("No"); return 0; }

        while(rgt--)  rem.push_back(val);
    }

    for(int i = N * N; i >= 1; i--)
    {
        if(ans[i])  continue;
        ans[i] = rem.back();
        rem.pop_back();
        if(i < f[ ans[i] ]) { printf("No"); return 0; }
    }

    printf("Yes\n");
    for(int i = 1; i <= N * N; i++)
        printf("%d ", ans[i]);

    return 0;
}


Measured memory_bytes: 2816
// Problem : D - Binomial Coefficients
// Contest : AtCoder Regular Contest 095
// URL : https://atcoder.jp/contests/arc095/tasks/arc095_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define size(x) (int)x.size()

const int N = 1e6 + 1, mod = 1e9 + 7, inf = 2e9;

int n, mx = 0, ans = 0, pos, a[N];

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		mx = max(mx, a[i]);
	}
	for (int i = 1; i <= n; i++) {
		if (a[i] <= mx / 2) {
			if (ans < a[i]) {
				ans = a[i];
				pos = i;
			}
		} else {
			if (ans < mx - a[i]) {
				ans = mx - a[i];
				pos = i - n;
			}
		}
	}
	cout << mx << ' ' << a[(pos + n) % n];
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int a[1000005],b[1000005],c[1000005],d[1000005];

int main()
{
	int n,i,x=0;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
		d[a[i]]++;
		b[i]=a[i]+1;
		d[b[i]]++;
		c[i]=a[i]-1;
		d[c[i]]++;
	}
	int cnt=0;
	for(i=0;i<1000005;i++){
		if(d[i]>cnt){
			cnt=d[i];
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 10880
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(a, b) for(a = 0; a < b; a++)

int main(){  
  int N, i;
  string _N;
  
  cin >> N;
  _N = to_string(N);
  
  rep(i, 3){
    
    if(_N.at(i) == '7'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

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

int main()
{
    int N,a;
    cin>>N;
    string S;
    cin>>S;
    a=S.size();
    for(int i=0;i<a;i++){
        for(int j=1;j<=N;j++){
            if(S.at(i)=='Z'){
                S.at(i)='A';
            }else{
                S.at(i)++;
            }
        }
    }
    cout <<S<<endl;
}

Measured memory_bytes: 256
N, L = map(int, input().split())
taste_list = []

for i in range(1, N+1):
    taste = L + i - 1
    taste_list.append((taste, abs(taste)))
    
sorted_taste_list = sorted(taste_list, key=lambda x: x[1])
del sorted_taste_list[0]
sum = 0
while sorted_taste_list:
    sum += sorted_taste_list.pop()[0]
print(sum)

Measured memory_bytes: 3064
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# 終了後に解説を見て解けた
# パス数が２のべき乗であれば簡単にグラフを構築できることに気付きたかった。
#
# 本番中は、10進法で考えて 頂点1と頂点2の間を辺{0, 100, 200, ..., 900}で繋ぎ、頂点2と頂点3の間を辺{0, 10, ..., 90}で繋ぎ、
# などという事を考えていたが、それ以上進展させることが難しかった。


import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

L = int(input())

v = 1
edges = []  # (from, to, cost)

# L = 37の場合を例にとりコメントを付与
# まず長さ0 ~ 31までのパスを作成する。
#   頂点1 -> 頂点2を0の辺と1の辺で結ぶ
#   頂点2 -> 頂点3を0の辺と2の辺で結ぶ
#   頂点3 -> 頂点4を0の辺と4の辺で結ぶ
#   頂点4 -> 頂点5を0の辺と8の辺で結ぶ
#   頂点5 -> 頂点6を0の辺と16の辺で結ぶ
n = 2
cost = 1
while n <= L:
    edges.append((v, v+1, 0))
    edges.append((v, v+1, cost))
    cost *= 2
    v += 1
    n *= 2

# 頂点6をv_sink(最終到達点)とする
v_sink = v

# ここから先、長さ32, 33, 34, 35, 36のパスを生成することになる。
# 頂点3と頂点6を、32の辺で直でつなぐと、長さ32, 33, 34, 35のパスが作れる。
# 頂点1と頂点6を、36の辺で直でつなぐと、長さ36のパスが作れる。
n //= 2
N = n
L -= N

while L > 0:
    if L >= n:
        edges.append((v, v_sink, N))
        L -= n
        N += n
    n //= 2
    v -= 1

print(v_sink, len(edges))
for e in edges:
    print(*e)

Measured memory_bytes: 7216
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
from functools import reduce
import sys
import math
import bisect
import random
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return list(map(float, sys.stdin.readline().split()))
def LS():return sys.stdin.readline().split()
def SR(n): return [list(sys.stdin.readline())[:-1] for i in range(n)]
def IR(n): return [int(sys.stdin.readline()) for i in range(n)]
def LIR(n): return [list(map(int, sys.stdin.readline().split())) for i in range(n)]
def LSR(n): return [list(map(list, sys.stdin.readline().split())) for i in range(n)]
_gcd = lambda x, y: _gcd(y, x%y) if (x%y) else y
_lcm = lambda x, y: x*y // _gcd(x, y)
def gcd(*numbers):
    return reduce(_gcd, numbers)
def lcm(*numbers):
    return reduce(_lcm, numbers)
sys.setrecursionlimit(1000000)
INF = float('inf')
intINF = int(1e15)
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]

N = I()
a = LI()

dp = [[intINF]*(N+1) for i in range(N+1)]
acc = [0]*(N+1)
for i in range(N):
    acc[i+1] = acc[i] + a[i]

for i in range(N-1):
    dp[i][i+2] = a[i]+a[i+1]
    dp[i][i+1] = 0
    dp[i][i] = 0
dp[N-1][N] = 0
dp[N-1][N-1] = 0
dp[N][N] = 0

for l in range(N-1)[::-1]:
    for r in range(l, N+1):
        for k in range(l+1,r):
            dp[l][r] = min(dp[l][r], dp[l][k]+dp[k][r]+(acc[r]-acc[l]))

print(dp[0][N])

Measured memory_bytes: 43484
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A,B,C,D;
    scanf("%d %d %d %d", &A,&B,&C,&D);

    while(true){
      C -= B;
      if(C <= 0){
        printf("Yes");
        return 0;
      }
      A -= D;
      if(A <= 0){
        printf("No");
        return 0;
      }
    }
}

Measured memory_bytes: 3776
def main() -> None:
    _ = int(input())
    V = [int(x) for x in input().split()]
    V.sort()
    ans = V[0]
    for v in V[1:]:
        ans = (v + ans) / 2
    print("{:.15f}".format(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<cstdio>
#include<vector>
using std::vector;

const int N=100000;

int n,L,a[N+5];
bool cut[N+5]={1};

int main()
{
	int k=0;
	scanf("%d %d",&n,&L);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<n;i++)
		if(a[i]+a[i+1] >= L)
			k=i;
	
	if(!k)
	{
		puts("Impossible");
		return 0;
	}
	puts("Possible");
	for(int i=1;i<k;i++)
		printf("%d\n",i);
	for(int i=n-1;i>k;i--)
		printf("%d\n",i);
	printf("%d\n",k);
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
    ll n;
    cin >> n;
    ll res = 0;
    for(int i = 1;i <= n;i++){
        ll b = n / i;
        if(n % i == 0)b--;
        if(b <= 0)continue;
        res += b;
    }
    cout << res << endl;
}

Measured memory_bytes: 3636
#[allow(unused_macros)]
macro_rules! input_byline {
    ($($r:tt)* ) => {
        let stdin = std::io::stdin();
        let mut q = std::collections::VecDeque::new();
        let mut next = || {
            if q.is_empty() {
                let mut s = String::new();
                stdin.read_line(&mut s);
                for v in s.split_whitespace() {
                    q.push_back(v.to_string());
                }
            }
            q.pop_front().unwrap()
        };
        input_inner!{next, $($r)*}
    };

}

#[allow(unused_macros)]
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

trait Printable {
    fn p(&self);
}

impl<T: std::fmt::Display> Printable for T {
    fn p(&self) {
        println!("{}", self);
    }
}

impl<T: std::fmt::Display> Printable for [T] {
    fn p(&self) {
        for i in 0..self.len() {
            if i != 0 {
                print!(" ");
            }
            print!("{}", self[i]);
        }
        println!("");
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        r: usize,
    }

    println!("{}", r * r);
}


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

int main(void)
{
  std::vector<int> x(5);
  for (int i = 0; i < 5; i++) {
    std::cin >> x.at(i);
  }

  for (int i = 1; i <= 5; i++) {
    if (x.at(i-1) == 0) {
      std::cout << i << std::endl;
      break;
    }
  }
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
int n, a, b, s, e;
int main(){
	scanf("%d%d%d", &n, &a, &b);
	n -= a;b--;
	if(b>n || n>(long long)a*b) return 0*puts("-1");
	rep(i,a){
		s += (b == 0 ? 0 : i<n/b ? b : i == n/b ? n%b : 0) + 1;
		for(int i = s; i > e; i--) printf("%d%s", i, s==n+a && i-1==e ? "\n" : " ");
		e = s;
	}
}

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

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long 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] % MOD) % MOD;
}

int main() {
    int n, k; cin >> n >> k;
    COMinit();
    int r = n - k + 1;
    // cout << COM(1998, 1) * COM(2, 2) << endl;
    // cout << COM(1998, 2) * COM(2, 1) << endl;
    // cout << COM(1998, 3) * COM(2, 0) << endl;
    for (int i = 1; i <= k; ++i) {
        cout << COM(r, i) * COM(k - 1, i - 1) % MOD << endl;
    }

    return 0;
}

Measured memory_bytes: 12160
import java.util.*;
import java.util.Map.Entry;
 
class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static long[] kaijo;
	 static long[] kaiinv;
//	 static int mod = 998244353;
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int K = sc.nextInt();
       
//       String S = sc.next();
//       String T = sc.next();
//       char[] s = S.toCharArray();
//       char[] t = T.toCharArray();
       
       int N=2*100000;
       kaijo = new long[N+100];
       kaijo[0]=1;
       for(int i=1;i<=N+88;i++) {
       	kaijo[i]=(kaijo[i-1]*i)%mod;
       }
       kaiinv = new long[N+100];
       kaiinv[0]=1;
       kaiinv[1]=1;
       for(int i=2;i<N+88;i++) {
       	kaiinv[i]=modinv(kaijo[i])%mod;
       }
       
       K=Math.min(K, n);
       long sum=0;
       for(int i=0;i<=K;i++) {
    	   long a=(nCr(n,i)*nCr(n-1,i))%mod;
    	   sum=(sum+a)%mod;
       }
       
       
       System.out.println(sum);
   }

	static long nCr(int n, int r) {
		if(n<r) {
			return 0;
		} else {
			return (kaijo[n]*(kaiinv[r]*kaiinv[n-r]%mod))%mod;
		}
	}

	public static long pow(long a,long n) {
	    long res=1;
	    while (n>0) {
	        if ((n-n/2*2)==1) {
	            res=(res*a)%mod;
	        }
	        a=(a*a)%mod;
	        n>>=1;
	    }
	    return res;
	}
 
	public static long modinv(long n) {
		return pow(n, mod-2)%mod;
	}


}

Measured memory_bytes: 26068
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
A, B = map(int, input().split())
print("Yay!" if A <= 8 and B <= 8 else ":(")

Measured memory_bytes: 3572
N,M = map(int,input().split())
sl = [list(map(int,input().split())) for _ in range(M)]

startnum = 0 if N==1 else 10**(N-1)

for i in range(startnum,10**N):
    str_i = str(i)
    count = 0
    for s,c in sl: 
        if(str_i[s-1]==str(c)):
            count += 1
    
    if(count==len(sl)):
        print(i)
        exit(0)

print(-1)

Measured memory_bytes: 39024
move :: String -> [Int] -> [Int]
move cmd (a:b:c:d:e:f:_) =
  case cmd of
    "North" -> [f,b,e,d,a,c]
    "East" ->  [d,a,b,c,e,f]
    "West" ->  [b,c,d,a,e,f]
    "South" -> [e,b,f,d,c,a]
    "Right" -> [a,e,c,f,d,b]
    "Left"  -> [a,f,c,e,b,d]
move _ _ = []

ans' :: Int -> [Int] -> [String] -> Int
ans' s _ [] = s
ans' s d (c:cs) =
  let d' = move c d
      s' = head d'
  in
    ans' (s+s') d' cs

ans :: [String] -> [Int]
ans [] = []
ans ("0":_) = []
ans (n:x) =
  let n' = read n :: Int
      d  = take n' x
      r  = drop n' x
  in
    (ans' 1 [1,3,6,4,5,2] d):(ans r)

main = do
  c <- getContents
  let i = map head $ map words $ lines c
      o = ans i
  mapM_ print o



Measured memory_bytes: 7576
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
#define fastio cin.tie(0); cin.sync_with_stdio(0);
#define MOD 1000000007
#define MAXN 200005

int N,f,s;
ll res = 1,power[MAXN];
map<pair<ll,ll>,int> cnt;
vector<pair<ll,ll>> v;

int main(){
    fastio; cin >> N;
    power[0] = 1;
    for(int i=1; i<=N; i++){
        power[i] = power[i-1]*2%MOD;
        ll a,b,g; cin >> a >> b;
        g = abs(__gcd(a,b));
        if(a < 0 && b < 0) g = -g;
        if(a) a/=g;
        if(b) b/=g;
//        cout << a << " " << b << endl;
        if(a == 0 && b){
            f++;
            continue;
        }else if(a && b == 0){
            s++;
            continue;
        }
        cnt[mp(a,b)]++;
        v.pb(mp(abs(a),abs(b)));
        v.pb(mp(abs(b),abs(a)));
    }
    sort(v.begin(),v.end());
    v.resize(unique(v.begin(),v.end())-v.begin());
    for(pair<ll,ll> check:v){
        if(check == mp(0LL,0LL)) continue;
        ll val = power[cnt[mp(check.second,-check.first)]]*power[cnt[mp(-check.second,check.first)]]%MOD;
        val = (val+power[cnt[check]]-1+MOD)%MOD;
        res = res*val%MOD;
    }
    res = (res*(power[f]+power[s])%MOD-res+MOD)%MOD;
    res = (res+cnt[mp(0LL,0LL)])%MOD;
    cout << (res-1+MOD)%MOD << '\n';
}

Measured memory_bytes: 85936