akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        
        int N=sc.nextInt();
        int acCount=0;
        int waCount=0;
        int tleCount=0;
        int reCount=0;
        
        String[] moziretu=new String[N];
        
        for(int i=0;i<N;i++){
            moziretu[i]=sc.next();    
        }
        
        for(int i=0;i<moziretu.length;i++){
            if(moziretu[i].equals("AC")){
                acCount++;
            }else if(moziretu[i].equals("WA")){
                waCount++;
            }else if(moziretu[i].equals("TLE")){
                tleCount++;
            }else if(moziretu[i].equals("RE")){
                reCount++;
            }
        }
        System.out.println("AC x "+acCount);
        System.out.println("WA x "+waCount);
        System.out.println("TLE x "+tleCount);
        System.out.println("RE x "+reCount);
	}
}

Measured memory_bytes: 66044
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INF = 1<<29;
const int MOD = 1000000007;
 
void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
 
const int MAX_V = 110;
const int MAX_E = 1100;
 
int N, M;
int a[MAX_E], b[MAX_E], c[MAX_E]; // 各辺
int dist[MAX_V][MAX_V]; // Floyd-Warshall 用
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
 
    rep(i,N){
      rep(j,N){
        dist[i][j] = INF;
      }
      dist[i][i] = 0;
    }
 
    rep(i,M){
      cin >> a[i] >> b[i] >> c[i];
      --a[i], --b[i];
      dist[a[i]][b[i]] = c[i];
      dist[b[i]][a[i]] = c[i];
    }
 
    rep(k, N)
      rep(i,N)
        rep(j,N)
          dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
 
      int ans = 0;
      rep(i,M) if(c[i] > dist[a[i]][b[i]]) ++ans;
      cout << ans << endl;
}


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

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

int main(void){
    using namespace  std;
    int H, N;
    cin >> H >> N;
    int A;
    long total = 0;
    rep(i, N){
        cin >> A;
        total += A;
    }

    cout << (total >= H ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 384
def inputInts
    gets.chomp.split(" ").map(&:to_i)
end

def getId(p, x)
    format('%06d', p) + format('%06d', x)
end

@N, @M = inputInts
@pres = {}
@cities = {}

(1..@N).each do |i|
    @pres[i] = []
end

(1..@M).each do |i|
    p, y = inputInts
    @pres[p] << i
    @cities[i] = [p, y]
end

# sort cities by founded year
(1..@N).each do |i|
    if @pres[i].length > 1
        @pres[i].sort! {|a, b| @cities[a][1] <=> @cities[b][1] }
    end
end

# add indexes to cities
(1..@N).each do |i|
    if @pres[i].length > 0
        @pres[i].each_with_index do |city, i|
            @cities[city] << i + 1
        end
    end
end

(1..@M).each do |i|
    city = @cities[i]
    puts getId(city[0], city[2])
end


Measured memory_bytes: 30312
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define OP ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> pii;
const int inf = int(1e9);
const int mod = inf + 7;
const double PI = acos(-1.0);
using namespace std;
const int N = 1e5 + 155;
template<typename T>
inline void read(T&x){
    x=0;int f=1;char ch = getchar();
    while(ch<'0' ||ch>'9'){ if(ch=='-')f=-1;ch=getchar(); }
    while(ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
    x*=f;
}

void solve(){
    string s;
    cin >> s;
    int ans = sz(s);
    int temp = ans;
    Rep(i, 1, sz(s) - 1){
        if(s[i] != s[i - 1]) ans = min(ans, max(i, temp - i));
    }
    cout << ans;
}
 
int main(){
    OP
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 512
n = gets.to_i
x = n / 3
y = n / 5
z = n / 15

puts n * (n + 1) / 2 - 3 * x * (x + 1) / 2 - 5 * y * (y + 1) / 2 + 15 * z * (z + 1) / 2

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

int main(){
    int x1, y1, x2, y2, x3, y3, x4, y4, a, b;
    cin >> x1 >> y1 >> x2 >> y2;
    a = x2 - x1;
    b = y2 - y1;
    x3 = x2 - b;
    y3 = y2 + a;
    x4 = x1 - b;
    y4 = y1 + a; 
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
    return 0;
}


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

using namespace std;

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

int parents[100005];
bool marked[100005];

int dfs(int node) { return marked[node]? node:dfs(parents[node]); }

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int n, q, node; char c;
    while(cin>>n>>q, n+q) {
        REP(i, 2, n+1) cin >> parents[i];
        memset(marked, false, sizeof(marked));
        marked[1] = true;
        long long ans = 0;
        rep(i, q) {
            cin >> c >> node;
            if(c == 'M') marked[node] = true;
            else ans += dfs(node);
        }
        cout << ans << endl;
    }
}



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

int main(){
	int a,b,c,x;
	cin >> a >> b >> c >> x;
	
	int cnt = 0;
	for(int i = 0;i<=a;i++){
		for(int j = 0;j<=b;j++){
			for(int k= 0;k<=c;k++){
				int as = i*500;
				int bs = j*100;
				int cs = k*50;
				if(as+bs+cs == x) cnt++;
			}
		}
	}
	
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
int copy(int x){return x;}
int main(){
	int h,w,k;cin>>h>>w>>k;
	vector<vector<int>> s(h,vector<int>(w));
	vector<vector<int>> sum(h + 1,vector<int>(w + 1,0));
	for(int i = 0; i < h; i++) {
		string st;cin>>st;
		for(int j = 0; j < w; j++) {
			s[i][j] = st[j] - '0';
			sum[i + 1][j + 1] = sum[i + 1][j] + s[i][j];
		}
	}

	for(int i = 0; i < h; i++) {
		for(int j = 0; j <= w; j++) {
			sum[i + 1][j] += sum[i][j];
		}
	}
	int res = INF;
	for(int bit = 0; bit < (1 << (h - 1)); bit++) {
		vector<int> war;
		vector<bool> used(w + 1,false);
		int ans = 0;
		for(int j = 0; j < h - 1; j++) {
			if ((bit >> j) & 1){
				war.pb(j);
				ans++;
			}	
		}
		war.pb(h - 1);
		vector<vector<int>> x(war.size(),vector<int>(w + 1));
		int index = 0;
		for(int i = 0; i < war.size(); i++) {
			for(int j = 0; j <= w; j++) {
				x[i][j] = sum[war[i] + 1][j] - sum[index][j];
			}
			index = war[i] + 1;
		}
		int l = 0;
		for(int r = 1; r <= w; r++) {
			bool flag = false;
			if (!flag){
				for(int j = 0; j < war.size(); j++) {
				if (x[j][r] - x[j][l] > k){
					if (r == l + 1){//そもそも区切れないとき
						flag = true;
						break;
					}
					l = copy(r - 1);
					ans++;
					break;
				}
			}
			}
			if(flag){
				ans = INF;
			}
			
		}
		res = min(res,ans);
	}
	cout << res << endl;
		
	return 0;
}

Measured memory_bytes: 384
// テ・ツ淞コテヲツ慊ャテ」ツδ?」ツδウテ」ツδ療」ツδャテ」ツδシテ」ツδ?(テァツクツョテ・ツーツ湘ァツ可?

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
typedef pair<int, int> pii;
typedef long long ll;
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int M, N;
vector<int> B, R;

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

// テ、ツコツ古ゥツδィテ」ツδ榲」ツδε」ツδ?」ツδウテ」ツつー (テヲツ慊?・ツ、ツァテヲツオツ?」ツつ津、ツスツソテ」ツ?」テ」ツ?ヲティツァツ」テ」ツ??
// テ」ツδサテヲツ卍ョテゥツ?堙」ツ?ォティツセツコテ」ツつ津・ツシツオテ」ツつ凝、ツサツ姪」ツ?ォテ」ツ??ィツ?ェテ・ツ按?」ツ?ァテ・ツ按・テ」ツ?ォテゥツ?づァツつケテ」ツつ?2 テ」ツ?、テァツ板ィテヲツ?湘」ツ?凖」ツつ?

template <typename T>
struct Edge {
    int to; T cap, cost; int rev;
    Edge(int t, T c, int r) : to(t), cap(c), rev(r) {}
    Edge(int t, T ca, T co, int r) : to(t), cap(ca), cost(co), rev(r) {}
};

template <typename T>
using Graph = vector< vector< Edge<T> > >;

struct BipartiteMatching {
    int S, T, E, a, b;
    vector< vector< Edge<int> > > G;
    vector<int> used;
    BipartiteMatching(int x, int y, int z) : S(x), T(y), E(z) {
        G.resize(S+T+2);
        used.resize(S+T+2);
        a = S + T, b = a + 1;
    }
    void add_edge(int from, int to, int cap) {
        G[from].push_back(Edge<int>(to  , cap, G[to  ].size()    ));
        G[to  ].push_back(Edge<int>(from, 0  , G[from].size() - 1));
    }
    void readGraph() {
        for(int i=0; i<M; i++) {
            for(int j=0; j<N; j++) {
                if(gcd(B[i], R[j]) != 1) {
                    add_edge(i, S+j, 1);
                }
            }
        }
        for(int i=0; i<S; i++) add_edge(a  , i, 1);
        for(int i=0; i<T; i++) add_edge(i+S, b, 1);
    }
    int dfs(int v, int t, int f) {
        if(v == t) return f;
        used[v] = true;
        for(size_t i=0; i<G[v].size(); i++) {
            Edge<int> &e = G[v][i];
            if(!used[e.to] && e.cap > 0) {
                int d = dfs(e.to, t, min(f, e.cap));
                if(d > 0) {
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
    int solve() {
        int flow = 0;
        while(1) {
            fill(used.begin(), used.end(), 0);
            int f = dfs(a, b, INF);
            if(f == 0) return flow;
            flow += f;
        }
    }
};

signed main() {
    while(cin >> M >> N, M || N) {
        BipartiteMatching fl(M, N, 0);
        B.resize(M); R.resize(N);
        rep(i,0,M) cin >> B[i];
        rep(i,0,N) cin >> R[i];
        fl.readGraph();
        cout << fl.solve() << endl;
    }
    return 0;
}

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

int main(void) {
  int W, H, N;
  cin >> W >> H >> N;
  int color[W][H] = { 0 };
  
  int x, y, a;
  for (int n = 0; n < N; ++n) {
    cin >> x >> y >> a;
    
	if (a == 1) {
      for (int w = 0; w < x; ++w) {
        for (int h = 0; h < H; h++) {
          color[w][h] = 1;
        }
      }
    } else if (a == 2) {
      for (int w = x; w < W; ++w) {
        for (int h = 0; h < H; h++) {
          color[w][h] = 1;
        }
      }
    } else if (a == 3) {
      for (int w = 0; w < W; ++w) {
        for (int h = 0; h < y; h++) {
          color[w][h] = 1;
        }
      }
    } else if (a == 4) {
      for (int w = 0; w < W; ++w) {
        for (int h = y; h < H; h++) {
          color[w][h] = 1;
        }
      }
    }
  }
  
  int res = 0;
  for (int w = 0; w < W; ++w) {
    for (int h = 0; h < H; ++h) {
      if (color[w][h] == 0) ++res;
    }
  }
  
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

#define rep(i,n) for(int i=0; i < n; i++)
using ll =  long long;
using namespace std;

int main()
{
    int n, k, ans = 0;
    cin >> n >> k;
    
    vector<int> x(n);
    rep(i, n) cin >> x[i];
    
    rep(i, n)
    {
        if (x[i] <= k / 2) ans += 2 * x[i];
        else ans += 2 * (k - x[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    int a = 0;
    char s[5];
    scanf("%s",s);
    for(int i = 0; i < 4; i++)
    {
        a += (s[i] == '+')? 1:(-1);
    }
    printf("%d\n",a);
}


Measured memory_bytes: 128
a,b = map(int,input().split())
if a == 1 and a != b :
    print("Alice")
elif b == 1 and b != a:
    print("Bob")
elif (a != 1 and b != 1) and a > b:
    print("Alice")
elif (a != 1 and b != 1) and a < b:
    print("Bob")
elif a == b:
    print("Draw")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin >> a >> b >> c;

    if (a+b+c>=22)
    {
        cout << "bust" << endl;
    }
    else
    {
        cout << "win" << endl;
    }
    
    
    
}




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

int main()
{

	int W_college[10], K_college[10];

	for(int i = 0; i < 20; i++) {
		i <= 9 ? cin >> W_college[i] : cin >> K_college[i - 10];
	}

	sort(W_college, W_college + 10);
	sort(K_college, K_college + 10);

	cout << W_college[7] + W_college[8] + W_college[9] << " " << K_college[7] + K_college[8] + K_college[9] << endl;

	return 0;

}

Measured memory_bytes: 3084
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=200000+19;
const int M=2000+19;
const int S=2001;
const int p=1e9+7;

int A[N],B[N];
int f[2*M][2*M],fac[4*M],inv[4*M];
int n,res;

int Pow(int a,int b){
	int res=1;
	for (;b;b>>=1,a=1ll*a*a%p) if (b&1) res=1ll*res*a%p;
	return res;
}
int C(int n,int m){
	return 1ll*fac[n]*inv[m]%p*inv[n-m]%p;
}

int main(){
	fac[0]=1;
	For(i,1,4*M) fac[i]=1ll*fac[i-1]*i%p;
	inv[4*M-1]=Pow(fac[4*M-1],p-2);
	for (int i=4*M-1;i;i--) inv[i-1]=1ll*inv[i]*i%p;
	n=IN();
	For(i,1,n+1){
		A[i]=IN(),B[i]=IN();
		f[-A[i]+S][-B[i]+S]++;
	}
	For(i,1,2*M) For(j,1,2*M){
		f[i][j]=(0ll+f[i][j]+f[i][j-1]+f[i-1][j])%p;
	}
	For(i,1,n+1){
		res=(res+f[A[i]+S][B[i]+S])%p;
		res=(res-C(2*A[i]+2*B[i],2*A[i])+p)%p;
	}
	printf("%d\n",1ll*res*Pow(2,p-2)%p);
}

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

int func(int M, int N)
{
    vector<int> res;
    int mx = 7368795, index = M, cnt = N;
    vector<bool> can(mx, false);
    while (cnt > 0)
    {
        if (can[index] == false)
        {
            can[index] = true;
            cnt--;
            for (int i = index; i < mx; i += index)
            {
                can[i] = true;
            }
        }
        index++;
    }
    int ans = 0;
    for (int i = M; i < mx; i++)
    {
        if (can[i] == false)
            return i;
    }
}

int M, N;

int main()
{
    while (cin >> M >> N)
    {
        if (M == 0 && N == 0)
            return 0;
        cout << func(M, N) << endl;
    }
}


Measured memory_bytes: 4000
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define OUT(a) cout<<(a)<<endl;
#define ALL(v) (v).begin(), (v).end()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
const LL LINF=1ll<<62; const int INF=1ll<<30; const LL MOD=1E9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    bool c[2]={};
    string s;
    cin >> s;
    REP(i,s.size()){
        if(s[i]=='C')c[0]=true;
        if(s[i]=='F' && c[0]) c[1]=true;
    }
    if(c[1])cout << "Yes" <<endl;
    else cout << "No" <<endl;

    return 0;
}


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

using namespace std;

#define MAX_LETTERS 20000

typedef struct tagDown
{
	int startPos;
	int lakeNum;
}DOWN;

DOWN downInfo[MAX_LETTERS];
int pos = 0;

void push(int p, int lake)
{
	pos++;
	downInfo[pos].startPos = p;
	downInfo[pos].lakeNum = lake;
}

DOWN pop(void)
{
	DOWN ret = downInfo[pos];
	pos--;
	return ret;
}

bool checkStack()
{
	if (pos <= 0)
		return false;
	else
		return true;
}

int main()
{
	char inputString[MAX_LETTERS] = { 0 };
	cin >> inputString;
	int ln = strlen(inputString);

	int allWater = 0;
	int water[10000] = { 0 };

	int sum = 0;
	int lake = 0;
	int prev = 0;

	for (int i = 0; i < ln; i++)
	{
		int line;
		int now = inputString[i];
		DOWN s;

		switch (now)
		{
		case '\\':
			if (now != prev)
			{
				lake++;
			}
			push(i, lake);
			break;
		case '/':
			if (checkStack())
			{
				s = pop();
				line = i - s.startPos;
				water[s.lakeNum] += line;
				allWater += line;
			}
			else
			{
				break;
			}
			if (s.lakeNum < lake)
			{
				int max = lake;
				for (int j = s.lakeNum+1; j <= max; j++)
				{
					water[s.lakeNum] += water[j];
					water[j] = 0;
					lake--;
				}
			}
			break;
		case '_':
			break;
		default:
			cout << "???" << endl;
		}
		prev = inputString[i];
	}

	cout << allWater << endl;
	int numberOfLake = 0;
	for (int i = 1; i <= lake; i++)
	{
		if (water[i])
			numberOfLake++;
	}
	cout << numberOfLake;
	for (int i = 1; i <= lake; i++)
	{
		if(water[i])
			cout << " " << water[i];
	}
	cout << endl;

    return 0;
}




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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S;
int W;


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S>>W;
	string T;
	FOR(i,S.size()) if(i%W==0) T+=S[i];
	cout<<T<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

typedef long long ll;
const ll mod=1e9+7;
const ll N=2e5+1;
const ll INF=1e10;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	int x;
	cin>>x;
	cout<<(x>=30?"Yes":"No");
}


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

using namespace std;


int main() {
    int N;
    vector<int> l;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int n;
        cin >> n;
        l.push_back(n);
    }
    sort(l.begin(), l.end(), greater<int>());
    cout << l.front() - l.back() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  #define FASTIO std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  using namespace std;
  #define endl '\n'
  #define deb cout<<"sab_badhiya"<<endl;
  typedef long long int ll;
  // const long long INF = 1000 * 1000 * 1000 * 1ll * 1000 * 1000 * 1000;
  const long INF = 1000 * 1000 * 1000 + 7;
  ll a[300000];
  vector<ll>v;
  int main() {
    int k, n;
    cin >> k;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (i > 0) {
        v.push_back(a[i] - a[i - 1]);
      }
    }
    v.push_back(a[0] + k - a[n - 1]);
    sort(v.rbegin(), v.rend());
    cout << k - v[0] << endl;

  }


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    ll N, D;
    cin >> N >> D;
    cout << (2 * D + N ) / (2 * D+1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main() {
 int a, b, c;
 int k;
 int n;
 scanf("%d%d%d", &a, &b, &c);
 n = 0;
 for (k = a; k <= b; k++) {
 if (c % k == 0) n++; }
 printf("%d\n", n);
 return 0;
} 


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;

int main() {

    int n;
    cin >> n;    
    vector<P> vp;
    rep(i, n){
        int a, b;
        cin >> a >> b;
        vp.emplace_back(b, a);
    }
    sort(all(vp));
    
    int time = 0;
    bool ok = true;
    rep(i, n){
        time += vp[i].second;
        if(time > vp[i].first){
            ok = false;
            break;
        }
    }
    if(ok){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define INF 0x3f3f3f3f
using namespace std;
int n,u,v,w,ans[100001];
vector<pair<int,int> > g[100001];
bool vis[100001];
void dfs(int n)
{
	vis[n]=true;
	for (int i=0;i<g[n].size();++i)
	{
		int t=g[n][i].first;
		int s=g[n][i].second;
		if (vis[t]) continue;
		vis[t]=true;
		if (s%2==0) ans[t]=ans[n];
		else ans[t]=1-ans[n];
		dfs(t);
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for (int i=0;i<n-1;++i)
	{
		cin>>u>>v>>w;
		g[u].pb(mp(v,w));
		g[v].pb(mp(u,w));
	}
	ans[1]=0;
	dfs(1);
	for (int i=1;i<n;++i) cout<<ans[i]<<endl;
	cout<<ans[n];
	return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
int C[3][3];

int main()
{
  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      cin >> C[i][j];
    }
  }
  for (int i = 0; i < 2; i++)
  {
    vector<int> v;
    for (int j = 0; j < 3; j++)
    {
      v.push_back(C[i + 1][j] - C[i][j]);
    }
    v.erase(unique(v.begin(), v.end()), v.end());
    if (v.size() != 1)
    {
      cout << "No" << endl;
      return 0;
    }
  }
  for (int j = 0; j < 2; j++)
  {
    vector<int> v;
    for (int i = 0; i < 3; i++)
    {
      v.push_back(C[i][j + 1] - C[i][j]);
    }
    v.erase(unique(v.begin(), v.end()), v.end());
    if (v.size() != 1)
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define B 1000000007
#define B2 10007

int W,H,P;
string s;
bool a[1100][1100];
bool b[1100][1100];
ull hs[1000][1000];
map<ull,int> cnt;
set<ull> used;

int f(char c){
  if(c>='A'&&c<='Z')return c-'A';
  if(c>='a'&&c<='z')return c-'a'+26;
  if(isdigit(c))return c-'0'+52;
  if(c=='+')return 62;
  return 63;
}

int main(){
  while(1){
    cin>>W>>H>>P;
    if(W==0)break;
    cnt.clear();
    used.clear();
    rep(i,H){
      cin>>s;
      rep(j,s.size()){
        rep(k,6){
          a[i][j*6+5-k]=(f(s[j])>>k)&1;
        }
      }
    }
    rep(i,P){
      cin>>s;
      rep(j,s.size()){
        rep(k,6){
          b[i][j*6+5-k]=(f(s[j])>>k)&1;
        }
      }
    }
    if(H<P||W<P){
      cout<<0<<endl;
      continue;
    }

    rep(i,H){
      ull h=0,elim=1;
      rep(j,P){
        h*=B;
        h+=a[i][j];
        elim*=B;
      }
      hs[i][0]=h;
      repl(j,P,W){
        h*=B;
        h-=elim*a[i][j-P];
        h+=a[i][j];
        hs[i][j-P+1]=h;
      }
    }
    rep(j,W-P+1){
      ull h=0,elim=1;
      rep(i,P){
        h*=B2;
        h+=hs[i][j];
        elim*=B2;
      }
      cnt[h]++;
      repl(i,P,H){
        h*=B2;
        h-=elim*hs[i-P][j];
        h+=hs[i][j];
        cnt[h]++;
      }
    }
    
    int res=0;
    rep(x,2)rep(y,2)rep(z,2){
      ull h=0;
      for(int i=(x?0:P-1);(x?i<P:i>=0);i+=(x?+1:-1)){
        ull h2=0;
        h*=B2;
        for(int j=(y?0:P-1);(y?j<P:j>=0);j+=(y?+1:-1)){
          h2*=B;
          h2+=(z?b[i][j]:b[j][i]);
        }
        h+=h2;
      }
      if(used.find(h)!=used.end())continue;
      used.insert(h);
      res+=cnt[h];
    }
    cout<<res<<endl;
  }
  return 0;
}



Measured memory_bytes: 44616
nxt = input().split()
#print(nxt)
N = int(nxt[0]) 
X = int(nxt[1])
T = int(nxt[2])
#print(N,X,T)
tmp = N/X - int(N/X)
if tmp == 0:
    counter = int(N/X)
else:
    counter = int(N/X) + 1
#print(counter)
print(counter * T)

Measured memory_bytes: 9048
#include <bits/stdc++.h>
using namespace std;
#define boost  ios_base::sync_with_stdio(0);
#define N 1000
#define ll long long int
#define pb push_back
#define f first
#define s second
#define fo(i,a,b) for(i = a; i < b; i++)
#define foe(i, a,b) for(i = a; i <= b; i++)
#define tc long long int t; cin >> t; while(t--)
#define vect vector <ll>
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll>>
#define be begin
#define en end
ll mod = 1e9+7;

int main(){
boost;
ll i;
ll n,m;
cin >> n >> m;
ll dp[n+1][m+1];
char x;
ll j;
for(i = 1; i <=n; i++){
for(j = 1; j <= m; j++){
  cin >> x;
if(x == '#'){
dp[i][j] = 0;
}
else{
dp[i][j] = -1;
}
}
}
dp[1][1]=1;
for(i = 2; i<= n; i++){
if(dp[i][1] != 0 && dp[i-1][1] != 0){
dp[i][1] = 1;
}
else dp[i][1]=0;
}
for(i = 2; i<= m; i++){
if(dp[1][i] != 0 && dp[1][i-1] != 0){
dp[1][i] = 1;}
else dp[1][i]=0;
}

for(i = 2; i <= n; i++){
for(j = 2; j <= m; j++){
if(dp[i][j] != 0){
dp[i][j] = (dp[i-1][j]%mod + dp[i][j-1]%mod)%mod;
}
}
}

cout << dp[n][m]% mod;

return 0;
}

Measured memory_bytes: 8064
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
int kaijou(int n){
    int a=1;
  if(n==0){
    return 1;
  }
    REP(i,n){
        a*=i+1;
    }
    return a;
}
int ncr(int n,int r){
  int a;
  if(n<0||r<0||n<r){
    return 0;
  }
  a=kaijou(n)/kaijou(r)/kaijou(n-r);
  return a;
}
//cout << setprecision(123);
int main(){
  string s,ss;
  int a=1,b=0;
  bool ok=true;
  cin>>s;
  if(s[0]==s[1]){
    a++;
  }
  if(s[0]==s[2]){
    a++;
  }
  if(s[0]==s[3]){
    a++;
  }
  if(a!=2){
    ok=false;
  }
  else{
    if(s[0]==s[1]&&s[2]!=s[3]){
      ok=false;
    }
    else if(s[0]==s[2]&&s[1]!=s[3]){
      ok=false;
    }
    else if(s[0]==s[3]&&s[1]!=s[2]){
      ok=false;
    }
  }
  
  
  
  
  if(ok){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; ++i)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
   int n; cin >> n;
   string s; cin >> s;

   ll sum = 0;   

   rep(i, n){
      if(s.at(i)=='R'){
         int sumg = 0;
         int sumb = 0;
         for(int j=0; j<i; j++){
            if(s.at(j)=='G'){
               sumg++;
            }
            else if(s.at(j)=='B'){
               sumb++;
            }
         }
         int sumg2 = 0;
         int sumb2 = 0;
         for(int j=i+1; j<n; j++){
            if(s.at(j)=='G'){
               sumg2++;
            }
            else if(s.at(j)=='B'){
               sumb2++;
            }
         }

         sum += sumb*sumg2 + sumb2*sumg;
      }
      else if(s.at(i)=='B'){
         int sumr = 0;
         int sumg = 0;
         for(int j=0; j<i; j++){
            if(s.at(j)=='R'){
               sumr++;
            }
            else if(s.at(j)=='G'){
               sumg++;
            }
         }
         int sumr2 = 0;
         int sumg2 = 0;
         for(int j=i+1; j<n; j++){
            if(s.at(j)=='G'){
               sumg2++;
            }
            else if(s.at(j)=='R'){
               sumr2++;
            }
         }

         sum += sumr*sumg2 + sumr2*sumg;
 
      }
      else{
         int sumr = 0;
         int sumb = 0;
         for(int j=0; j<i; j++){
            if(s.at(j)=='R'){
               sumr++;
            }
            else if(s.at(j)=='B'){
               sumb++;
            }
         }
         int sumr2 = 0;
         int sumb2 = 0;
         for(int j=i+1; j<n; j++){
            if(s.at(j)=='B'){
               sumb2++;
            }
            else if(s.at(j)=='R'){
               sumr2++;
            }
         }

         sum += sumr*sumb2 + sumr2*sumb; 
      }

   }

   ll cnt = 0;
   rep(i, n){
      for(int j=0; j<i; j++){
         if(s.at(i)==s.at(j)){
            continue;
         }
         else{
            if(2*i-j>=n) continue;
            if(s.at(i)==s.at(2*i-j) || s.at(j)==s.at(2*i-j)){
               continue;
            }
            cnt++;
         }
      }
   }

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


Measured memory_bytes: 3596
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int ans = 0;
  for(int a = 1; a <= n; a++){
	  for(int b = 1; b <= n; b++){
		  for(int c = 1; c <= n; c++){
			 ans += gcd(a, gcd(b, c));
		  }
	  }
  }
  
  cout << ans << "\n";   
  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
	string s;
	int i,j;
	cin>>s;
	for(i=0;s[i]!='A';i++){}
	for(j=s.length();s[j]!='Z';j--){}
	j++;
	cout<<j-i<<"\n";
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

int main(){
  int N; cin>>N;
  int ct=0,cx=0,cy=0;
  int nt,nx,ny;
  bool ok = true;
  REP(i,N){
    cin >>nt>>nx>>ny;
    int d = abs(nx-cx)+abs(ny-cy);
    if(d>nt){ok=false;break;}
    if(d%2 != nt%2){ok = false; break;}
  }
  cout << (ok?Liny:Linn);
}

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

using namespace std;

const int Nmax = 2e5 + 5;
const int oo = LONG_MAX;

int n;
int a[Nmax];

int main()
{ /**
    #ifndef ONLINE_JUDGE

        ifstream cin("test.in");

    #endif // ONLINE_JUDGE
*/
    cin >> n;

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

    int minim = a[1], sol = 1;

    for(int i = 2; i <= n; i++)
        if(a[i] < minim)
        {
            sol ++ ;
            minim = a[i];
        }

    cout << sol;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	int H,W;
	cin >> H >> W;
	vector<string> S(H);
	for(int i=0;i<H;i++) cin >> S[i];
	
	int remC[W];
	int remR[H];
	for(int i=0;i<H;i++) remR[i] = 0;
	for(int j=0;j<W;j++) remC[j] = 0;
	
	for(int i=0;i<H;i++){
		bool chk = true;
		for(int j=0;j<W;j++) chk &= S[i][j] == '.';
		if(chk)  remR[i] = 1;
	}
	for(int j=0;j<W;j++){
		bool chk = true;
		for(int i=0;i<H;i++) chk &= S[i][j] == '.';
		if(chk) remC[j] = 1;
	}
	
	for(int i=0;i<H;i++){
		if(remR[i] == 1) continue;
		for(int j=0;j<W;j++) if(remC[j] == 0) cout << S[i][j];
		cout << endl;
	}
	
	
	
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	char a[102];
	int c[31] = {0};
	scanf("%s",a);
	for(int i=0;a[i]!='\0';i++)c[a[i]-'a']++;
	for(int i=0;i<30;i++)if(c[i]%2)printf("No"),exit(0);
	printf("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

char s[3000][3000];
int d[4][3000][3000];

int main(){
	int h,w;cin>>h>>w;
	rep(i,h){
		scanf("%s",s[i]);
	}
	rep(i,h){
		for(int j=0;j<w;j++){
			if(s[i][j]=='#')d[0][i][j]=0;
			else d[0][i][j]=(j?d[0][i][j-1]:0)+1;
		}
		for(int j=w-1;j>=0;j--){
			if(s[i][j]=='#')d[1][i][j]=0;
			else d[1][i][j]=(j+1<w?d[1][i][j+1]:0)+1;
		}
	}
	rep(j,w){
		for(int i=0;i<h;i++){
			if(s[i][j]=='#')d[2][i][j]=0;
			else d[2][i][j]=(i?d[2][i-1][j]:0)+1;
		}
		for(int i=h-1;i>=0;i--){
			if(s[i][j]=='#')d[3][i][j]=0;
			else d[3][i][j]=(i+1<h?d[3][i+1][j]:0)+1;
		}
	}
	int Max=0;
	rep(i,h)rep(j,w){
		if(s[i][j]=='#')continue;
		Max=max(Max,d[0][i][j]+d[1][i][j]+d[2][i][j]+d[3][i][j]-3);
	}
	cout<<Max<<endl;
}

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

int main() {
    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;

    bool flag = abs(a-b)<=k
             && abs(a-c)<=k
             && abs(a-d)<=k
             && abs(a-e)<=k
             && abs(b-c)<=k
             && abs(b-d)<=k
             && abs(b-e)<=k
             && abs(c-d)<=k
             && abs(c-e)<=k
             && abs(d-e)<=k;

    if(flag) cout << "Yay!" << endl;
    else cout << ":(" << endl;

}


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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

int a, b, c, d, e, n, m, k;
string s, t, r;
char c1, c2, c3;

int A[200005];
int B[200005];
int C[200005];

int main() {
	cin >>s>>t;
  	int cnt = 0;
  	for (int i=0 ;i<s.size() ; i++) {
      if (s[i] != t[i]) cnt++;
    }
  	cout <<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3852
n, k = map(int,input().split())
a = list(map(int,input().split()))

s = [True] * n
c = [1]
now = 0
while s[now]:
    s[now] = False
    now = a[now] - 1
    c.append(now+1)

start_cycle = c.index(c[-1])
loop = c[start_cycle:-1]
cycle = len(loop)

if k < start_cycle:
    print(c[k])
else:
    k -= start_cycle
    k %= cycle
    print(loop[k])

Measured memory_bytes: 95548
#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;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    string s;
    cin >> s;
    for(ll i = 0; i < 3; i++)
        if(s[i] == s[i + 1])
        {
            cout << "Bad\n";
            return 0;
        }
    cout << "Good\n";
    return 0;
}

Measured memory_bytes: 256
#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;
// 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 = 1e5+9;
// const ll m = 1e9 + 7;
// const ll inf= 1e14;
const ll mod =998244353;
#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; }
ll a[N];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
    #endif  
    int t = 1;
    // cin>>t;
    while(t--){
        ll n,L;cin>>n>>L;
        for(int i = 0;i<n;i++){
            cin>>a[i];
        }
        ll las = -1;
        for(int i = 1;i<n;i++){
            if(a[i]+a[i-1]>=L){
                las = i;
            }
        }
        if(las==-1){
            cout<<"Impossible";
            return 0;
        }
        cout<<"Possible\n";
        for(int i = 1;i<las;i++){
            cout<<i<<'\n';
        }
        for(int i = n-1;i>las;i--){
            cout<<i<<'\n';
        }
        cout<<las<<'\n';
    }
}

Measured memory_bytes: 4432
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

int main(){
  vector<ll> dp(31);
  dp[0]=1;
  for(int i=1; i<=30; i++){
    dp[i] += dp[i-1];
    if(i>1)
      dp[i] += dp[i-2];
    if(i>2)
      dp[i] += dp[i-3];
  }
  rep(i,31) dp[i] = ((dp[i]+9)/10+364)/365;
  int n;
  while(cin >> n && n!=0)
    cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 3000
N,K = list(map(int,input().split()))
R,S,P = list(map(int,input().split()))
T = input()
from collections import defaultdict
dp = defaultdict(int)

score = {"R":R,"P":P,"S":S}
def battle(user, box):
  d ={"S":0,"R":1,"P":2,
      "s":-1,"r":-2,"p":0}
  if (d[user] + d[box])%3 == 0:
    return score[user]
  else:
    return 0

for idx, teki in enumerate(T):
  for usr in "RPS":
  	dp[(idx,usr)] = max([
      dp[(idx-K,prev)]+battle(usr,teki) for prev in ("RPS".replace(usr,"")) 
    ])
    
print(sum ([max([dp[(N-r-1,te)] for te in "RPS"]) for r in range(K)]))

Measured memory_bytes: 132608
a=-1,A=65,d;
char
*N="GKSOCNWLDFVTBRXHAJUPEMQI",
*E="PHLTIDOXQAGWECSUMBKVJFNR",
*R="BCDAFGHEJKLINOPMRSTQVWXU",
s[9];
main(c)
{
for(;c-48&&scanf("%s",s);a+=d/4+1)
{
(c=*s)<A?~a&&printf("%d\n",a),a=d=0:0;
if(c==78)d=N[d]-A;
if(c==69)d=E[d]-A;
if(c==82)d=R[d]-A;
if(c==87)d=E[E[E[d]-A]-A]-A;
if(c==83)d=N[N[N[d]-A]-A]-A;
if(c==76)d=R[R[R[d]-A]-A]-A;
}}

Measured memory_bytes: 0
n,q=map(int,input().split())
s=input()
list=[0]
for i in range(n-1):
  if s[i]=='A' and s[i+1]=='C':
    list.append(list[i]+1)
  else:
    list.append(list[i])
for j in range(q):
  l,r=map(int,input().split())
  print(list[r-1]-list[l-1])

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

int main(void){
    ll n;
    cin >> n;

    ll t[n+1], a[n+1], b[n+1];
    t[0] = 0;
    a[0] = 0;
    b[0] = 0;
    rep(i, n){
        cin >> t[i+1] >> a[i+1] >> b[i+1];
    }

    rep(i, n){
        if(abs(a[i] - a[i+1]) + abs(b[i] - b[i+1]) > t[i+1] - t[i]){
            cout << "No" << endl;
            return 0;
        }
        if((abs(a[i] - a[i+1]) + abs(b[i] - b[i+1])) % 2 != (t[i+1] - t[i]) % 2){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 2560
N=int(input())
S=input()
if N%2==1:
  print("No")
else:
  s=""
  b=""
  for j in range(N//2):
    s=s+str(S[j])
  for i in range(N//2,len(S)):
    b=b+str(S[i])
  if s==b:
    print("Yes")
  else:
    print("No")

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    int a, b, h;
    cin >> a >> b >> h;
    printf("%lld\n", (a + b) * h / 2);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

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

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

const int N = 100+5;
const int W = 10000+5;
const int inf = 1e9;

int n, C;
int memo[W];

int main(){
	ri2(n, C);
	for(int i = 1; i <= C; i++) memo[i] = -inf;
	for(int i = 1; i <= n; i++){
		int v, w;
		ri2(v, w);
		for(int j = C; j >= w; j--){
			memo[j] = max(memo[j], memo[j - w] + v);
		}
		for(int j = w; j <= C; j++){
			memo[j] = max(memo[j], memo[j - w] + v);
		}
	}
	printf("%d\n", *max_element(memo, memo + C + 1));
	return 0;
}


Measured memory_bytes: 3256
#include<stdio.h>
#include<string.h>
int main(){
  int n,i,j,k,cnt=0;
  char s[50];
  scanf("%d",&n);
  scanf("%s",s);
  for(i=0; i<n; i++){
    j=i+1;
    k=i+2;
    if(s[i]=='A'){
      if(s[j]=='B'){
        if(s[k]=='C'){
          cnt++;
        }
      }
    }

  }
  printf("%d\n",cnt);
  return 0;
}


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

Measured memory_bytes: 3076
#include<bits/stdc++.h>
#include<string.h>
#define pb push_back
#define all(v) v.begin(),v.end()
#define see(x) cout<<#x<<" : "<<(x)<<endl;
#define ya cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define ff first
#define sc second
typedef long long ll;
using namespace std;
int main()
{
//    ios::sync_with_stdio(false);
//    cin.tie(NULL),cout.tie(NULL);
    //freopen("test.txt","r",stdin);
    string s;
    cin>>s;
    for(int i=0;i<=2;i++)
        cout<<s[i];
    return 0;
}


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

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int A,B,a,b;
  scanf("%d %d",&A,&B);
  for(int i=0;i<1010;i++){
    a=i*0.08;
    b=i*0.1;
    if(a==A&&b==B){
    printf("%d\n",i);
  return 0;
    }
  }
  printf("-1\n");
}


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

int main() {
	long long X[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	string Y[7] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
	long long M, D;
	while (cin >> M >> D) {
		if (M == 0 && D == 0) return 0;
		M--, D--;
		long long NM = 0, ND = 0, COUNT = 3;
		while (1) {
			if (NM == M && ND == D) break;
			COUNT++;
			ND++;
			if (ND == X[NM]) NM++, ND = 0;
		}
		cout << Y[COUNT % 7] << endl;
	}
}


Measured memory_bytes: 3168
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int h=sc.nextInt();
        int w=sc.nextInt();
		int k=sc.nextInt();
		int ans=0;

  		String[][] a=new String[h][w];
		for(int c=0;c<h;c++){
          String s=sc.next();
		a[c]=s.split("");
    		
    	}
    
 	for(int f=0;f<(1<<h);f++){
    	for(int g=0;g<(1<<w);g++){
        	int count=0;
          	for(int d=0;d<h;d++){
            if((1&f>>d)==1){
              for(int e=0;e<w;e++){
              if((1&g>>e)==1&&a[d][e].equals("#")){
              count++;
              }
              }
     }
            }
          if(count==k){
          ans++;
          }
        }
    }

    	System.out.println(ans);
    }
}

Measured memory_bytes: 35440
#include <iostream>
#include <algorithm>
#include <vector>
#include <bits/stdc++.h>

#define unsigned int long long
#define p(a, b) pair<a,b>

using namespace std;

//ifstream cin("Input.txt");
//ofstream cout("Output.txt");

int main() {
    string s;
    cin >> s;
    uint64_t k;
    cin >> k;
    k--;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '1' && i == k) {
            cout << 1;
            break;
        }
        if (s[i] != '1') {
            cout << s[i];
            break;
        }
    }
    return 0;
}




Measured memory_bytes: 256