akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    int N, M, A, B, C;
    string s1, s2;
    cin >> N;
    vector<int> P(N);
    rep(i, N) cin >> P[i];
    int Min = 1 << 30;
    int ans = 0;
    rep(i, N){
        // cout << P[i] << " " << Min << endl;
        if(P[i] < Min) ans++;
        Min = min(Min, P[i]);
    }
    cout << ans << endl;
} 

Measured memory_bytes: 4028
#include<bits/stdc++.h>
using namespace std;
struct brac
{
    bool type;
    int need, supply;
    brac(string& s)
    {
        int minnest_min = 0;
        int curr = 0;
        for(const char& c : s)
        {
            if(c=='(')
                curr++;
            else
                curr--;
            minnest_min = min(minnest_min,curr);
        }
        
        if(curr >= 0)
        {
            this->need = -minnest_min;
            this->supply = curr;
        }
        else //curr < 0
        {
            this->need = curr-minnest_min;
            this->supply = -curr;
        }
        type = curr < 0;

    }
    bool operator <(const brac& other)const
    {
        return this->need < other.need;
    }
};
bool solve()
{
    int n; cin >> n;
    
    vector<brac> pos[2]; pos[0].reserve(n), pos[1].reserve(n);
    for(int i = 0; i < n; i++)
    {
        string s; cin >> s;
        brac b(s);
        pos[b.type].push_back(b);
    }

    int curr[] = {0,0};
    for(int t = 0; t < 2; t++)
    {
        sort(pos[t].begin(),pos[t].end());

        for(const auto& brac : pos[t])
        {
            if(curr[t] < brac.need)
                return false;
            curr[t] += brac.supply;
        }
    }
    return curr[0]==curr[1];
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cout<<(solve()?"Yes":"No")<<endl;

    return 0;
}

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

int main() {
  int N, K;
  string S;
  cin >> N >> S >> K;
  char nochange = S[K-1];
  for(int i = 0; i < N; i++){
    if (S[i] != nochange){
      S.replace(i, 1, "*");
    }
  }
  cout << S << endl;
}

Measured memory_bytes: 3572
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

MOD = 10**9+7
H, W = map(int, input().split())
grid = [['#']*(W+2) for _ in range(H+2)]

for i in range(H):
    l = input()[:-1]
    for j, c in enumerate(l):
        grid[i+1][j+1] = c

dp = [[0]*(W+2) for _ in range(H+2)]
dp[1][0] = 1

for i in range(1, H+1):
    for j in range(1, W+1):
        if grid[i][j] == '.':
            dp[i][j] = dp[i-1][j]+dp[i][j-1]
            dp[i][j] %= MOD

print(dp[-2][-2])


Measured memory_bytes: 88540
import java.io.*;
import java.util.Arrays;
import java.util.stream.IntStream;

public class Main {
  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out)) {

      final int MAX = 100000;
      int n = Integer.parseInt(in.readLine());

      int[] table = new int[MAX+1];
      in.lines()
        .limit(n)
        .map(s -> s.split(" "))
        .map(a -> Arrays.stream(a).mapToInt(Integer::parseInt).toArray())
        .forEach(a -> IntStream.rangeClosed(a[0],a[1])
          .forEach(i -> table[i] = 1)
        );

      final int ans = Arrays.stream(table).sum();
      System.out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

Measured memory_bytes: 26708
n,k = gets.chomp.split(" ").map(&:to_i)

dict = {}
arr = gets.chomp.split(" ").map(&:to_i)

arr.sort!
arr.each do |num|
  if dict[num].nil?
    dict[num] = 1
  else
    dict[num] += 1
  end
end
dict = dict.sort{|(k1,v1),(k2,v2)| v1<=>v2 }
s = arr.uniq.size

arr = arr.join

count = 0
(s - k).times do |i|
  count += dict[i][1]
end

puts count

Measured memory_bytes: 55140
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define eps 1e-13
#define PI 3.14159265359
#define sp printf(" ")
#define vi vector<int>
#define vl vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pcc pair<char, char>
#define mp make_pair
#define FF first
#define SS second
#define pb(x) push_back(x)
#define sd(x) scanf("%d", &(x))
#define pd(x) printf("%d", (x))
#define pdn(x) printf("%d\n", (x))
#define sld(x) scanf("%ld", &(x))
#define pld(x) printf("%ld", (x))
#define pldn(x) printf("%ld\n", (x))
#define slf(x) scanf("%lf", &(x))
#define plf(x) printf("%.9lf", (x))
#define plfn(x) printf("%.9lf\n", (x))
#define sch(x) scanf("%c", &(x))
#define pch(x) printf("%c", (x))
#define pchn(x) printf("%c\n", (x))
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios::sync_with_stdio(false); cin.tie(0)
#define endl '\n'
ll dp[10003];
int main()
{
    int k,s;
    cin>>k>>s;
    dp[0]=1;
    ll ans=0;
    for(int i=1;i<=s;i++)
    {
        for(int j=0;j<=k&&j<=i;j++)
        {
            if(i-j<=k)dp[i]++;
        }
    }
    for(int j=0;j<=k&&j<=s;j++)
    {
        ans=ans+dp[s-j];
    }
    cout<<ans<<endl;



}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.*;
 class Main
{
	public static void main (String[] args)
	 {
		Scanner sc=new Scanner(System.in); 
		int i,j;
		int n=sc.nextInt();
		int m=sc.nextInt();
		HashMap<Integer,Integer> h=new HashMap();
		HashMap<Integer,Integer> v=new HashMap();
		for(i=1;i<=n;i++)
		{
			h.put(i, sc.nextInt());
			v.put(i,1);
		}
		
		int in,og;
		for(i=0;i<m;i++)
		{
			in=sc.nextInt();
			og=sc.nextInt();
			if(h.get(in)==h.get(og))
			{
				v.put(in, -1);
				v.put(og, -1);
			}
		 if(h.get(in)>=h.get(og))
			{
				v.put(og, -1);
			}
			 if(h.get(in)<=h.get(og))
			{
				v.put(in,-1);
			}
		}
		int count=0;
		for(i=1;i<=n;i++)
		{
			if(v.get(i)!=-1)
				count++;
		}
		
		
			
		System.out.println(count);
		
			
	}
}

Measured memory_bytes: 84772
N = int(input())
h = list(map(int,input().split()))
h.append(0)
st = 0
res = 0
for i in range(1,101):
  for j in h:
    if j >= i:
      st = 1
    else:
      if st == 1:
        res  =  res + 1
        st = 0
print(res)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
int main() {
cout << fixed << setprecision(30);
  ll n,q;
  string s;
  cin>>n>>q>>s;
  loop(i,n-1){
    if(s[i]=='A'&&s[i+1]=='C')s[i]='#';
  }
  vec num(n+1);
  num[0]=0;
  ll now=0;
  loop(i,n){
  if(s[i]=='#'){
    now++;
  }
    num[i+1]=now;
  }
  vec l(q);
  vec r(q);
  loop(i,q)cin2(l[i],r[i]);
  loop(i,q){
    putout(num[r[i]-1]-num[l[i]-1]);
  }
}

Measured memory_bytes: 3456
import java.util.*;


class Main {
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        HashMap<String ,Integer> m=new HashMap<>();
        int max=-1;
        for (int i = 0; i <n ; i++) {
            String key=s.next();
            int now=m.getOrDefault(key,0)+1;
            if(max<now){
                max=now;
            }
            m.put(key,now);
        }
        Set<String > set=new TreeSet();
        for(Map.Entry<String,Integer> p: m.entrySet()){
            if(p.getValue()==max){
                set.add(p.getKey());
            }
        }
        for (String jj:set){
            System.out.println(jj);
        }

    }
    public static void main2(String args[]) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int[] a=new int[n];
        for (int i = 0; i <n ; i++) {
            a[i]=s.nextInt();
        }
        String ret="APPROVED";
        for (int i = 0; i < n; i++) {
            if(a[i]%2==0&&(a[i]%3!=0&&a[i]%5!=0)){
                ret="DENIED";
                break;
            }

        }

        System.out.println(ret);

    }
}

Measured memory_bytes: 88940
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N, X;
    int m = INT_MAX;
    cin >> N >> X;
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        X -= x;
        m = min(m, x);
    }
    int ans = N;
    while (1) {
        if (m <= X) {
            X -= m;
            ans++;
        }
        else {
            cout << ans << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
typedef long long ll;

int main(){
  int n;
  int a[109];
  cin>>n;
  rep(i,n){
    cin>>a[i];
  }
  int ans=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if(i==j)continue;
      ans+=a[i]*a[j];
    }
  }
  cout<<ans<<endl;
  return(0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    ll n, k; cin >> n >> k;

    ll ans = 1;
    rep(i, n) {
        ans *= k;
        ans %= MOD;
        k--;
    }
    cout << ans << endl;
}



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

int progress(vector<int> &lens){
    sort(lens.begin(), lens.end());
    int foo=0;
    for(int i=0; i<(int)lens.size(); i+=2){
        foo+=lens[i];
    }
    return foo;
}

int main(){
    int n;
    while(scanf("%d", &n)!=EOF){
        vector<int> a;
        for(int i=0; i<n; i++){
            int x, y;
            scanf("%d%d", &x, &y);
            a.push_back(x);
            a.push_back(y);
        }
        printf("%d\n", progress(a));
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <cstring>
#include <cstdio>

using namespace std;

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

int N, K;
vector<P> edges;

bool E[100][100];
int d[100][100];
set<int> Ks;

const int INF = 1<<29;

void warshall_floyd() {
    rep(i, N) rep(j, N) {
        d[i][j] = E[i][j] ? 1 : INF;
    }
    rep(k, N) {
        rep(i, N) {
            rep(j, N) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int calcK() {
    warshall_floyd();
    int K = 0;
    rep(i, N) {
        for(int j=i+1; j < N; j ++) {
            if (d[i][j] == 2) K ++;
        }
    }
    return K;
}

/*
bool connected() {
    queue<int> q;
    bool visited[100] = {};
    q.push(0);
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        if (!visited[v]) {
            visited[v] = true;
            rep(i, N) {
                if (E[v][i]) q.push(i);
            }
        }
    }
    rep(i, N) {
        if (!visited[i]) return false;
    }
    return true;
}

void print() {
    rep(i, N) {
        rep(j, N) {
            if (j > i && E[i][j]) printf("(%d,%d)", i, j);
        }
    }
    puts("");
}

void f(int number) {
    if (number == N * N) {
        if (connected()) {
            int K = calcK();
            if (N == 5 && K == 6) print();
            Ks.insert(K);
        } else {
        }
        return;
    }
    int i = number % N;
    int j = number / N;
    if (i >= j) {
        f(number + 1);
    } else {
        E[i][j] = E[j][i] = 1;
        f(number + 1);
        E[i][j] = E[j][i] = 0;
        f(number + 1);
    }
}
*/

int main() {
    cin >> N >> K;
    rep(i, N - 1) {
        edges.push_back(make_pair(0, i+1));
        E[0][i+1] = E[i+1][0] = 1;
    }
    int C = (N - 2) * (N - 1) / 2 - K;
    if (C < 0) {
        cout << -1 << endl;
        return 0;
    }
    int c = 0;
    for (int i = 1; i < N; i ++) {
        for (int j = i + 1; j < N; j ++) {
            if (c >= C) goto brk;
            c ++;
            edges.push_back(make_pair(i, j));
            E[i][j] = E[j][i] = 1;
        }
    }
brk:
    cerr << calcK() << endl;
    cout << edges.size() << endl;
    for(auto edge : edges) {
        cout << (edge.first + 1) << " " << (edge.second + 1) << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
using namespace std;
#define _GLIBCXX_PERMIT_BACKWARD_HASH
#include <ext/hash_map>
using namespace __gnu_cxx;
struct str_hash{size_t operator()(const string& str)const{return __stl_hash_string(str.c_str());}};
typedef long long ll;
typedef unsigned long long ull;
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDD pair<double,double>
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-8;
const int MAX=1e5+10;
const ll mod=1e9+7;
int a[MAX],b[MAX];
int main()
{
	int n,h,i,ans,maxx;
	while(~scanf("%d%d",&n,&h))
	{
		maxx=-1;
		for(i=0;i<n;i++)
		{
			scanf("%d%d",&a[i],&b[i]);
			maxx=max(maxx,a[i]);
		}
		sort(a,a+n);
		sort(b,b+n);
		ans=0;
		for(i=n-1;i>=0&&h>0;i--)
		{
			if(b[i]>=maxx)
			{
				h-=b[i];
				ans++;
			}
			else break;
		}
		h=max(0,h);
		printf("%d\n",ans+(h+a[n-1]-1)/a[n-1]);
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 200010;
const int MAXK = 110;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int a, b;
    cin >> a >> b;
    if ((a + b) % 2) cout << "IMPOSSIBLE";
    else cout << (a+b) / 2;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s;
long long k[30],ans=1;
int main() {
	cin>>s;
	for(int i=0;i<s.length();++i){
		++k[s[i] - 'a'];
	}
	for (int i = 0; i < 26; ++i) {
		for (int j = i + 1; j < 26; ++j) {
			ans += k[i] * k[j];
		}
	}
	cout<<ans<<endl;
}


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

int X, Y;

int dis(int x, int y) {
	if (x <= y) return y-x;
	else return 2000000000;
}

int main() {
	scanf("%d%d", &X, &Y);
	printf("%d\n", min(min(dis(X, Y), dis(-X, Y)+1), min(dis(X, -Y)+1, dis(-X, -Y)+2)));
}


Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int score = 0;
        if (A > B) {
            score += A;
            A--;
        } else {
            score += B;
            B--;
        }
        if (A > B) {
            score += A;
            A--;
        } else {
            score += B;
            B--;
        }
        System.out.println(score);
    }
}

Measured memory_bytes: 21844
import Control.Monad
import Data.List
import Data.Bits
import Debug.Trace
import Data.Maybe
import qualified Data.ByteString.Char8 as C

main :: IO ()
main = do
  [n, k] <- readInts
  input <- readInts
  print $ solve n k input

solve :: Int -> Int -> [Int] -> Int
solve n k input = if m == 0 then r else r + 1
  where
    r = (n - 1) `div` (k - 1)
    m = (n - 1) `mod` (k - 1)

-- 以下ライブラリ

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

readNInts :: Int -> IO [[Int]]
readNInts = flip replicateM readInts

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . C.readInteger) . C.words <$> C.getLine

readNIntegers :: Int -> IO [[Integer]]
readNIntegers = flip replicateM readIntegers

getNLns :: Int -> IO [String]
getNLns = flip replicateM getLine

toTup2 :: [[a]] -> [(a, a)]
toTup2 = map (\ys -> case ys of y : z : zs -> (y, z))

encIdx2 :: Int -> (Int, Int) -> Int
encIdx2 mx (y, x) = y * mx + x

decIdx2 :: Int -> Int -> (Int, Int)
decIdx2 mx idx = (idx `div` mx, idx `mod` mx)

encIdx3 :: (Int, Int) -> (Int, Int, Int) -> Int
encIdx3 (my, mx) (z, y, x) = z * my * mx + y * mx + x

decIdx3 :: (Int, Int) -> Int -> (Int, Int, Int)
decIdx3 (my, mx) idx = (z, y, x)
  where
    basez = my * mx
    z = idx `div` basez
    y = (idx `mod` basez) `div` mx
    x = idx `mod` mx

while :: Monad m => m Bool -> m () -> m ()
while cond body = do
  b <- cond
  when b $ do
    body
    while cond body


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  int ans = 0;
  vector<int> vec(a);
  for (int i = 0; i < a; i++) cin >> vec.at(i);
  for (int i = 0; i < a; i++) {
    ans += vec.at(i) - 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define M 1000000007
#define M2 998244353
#define ll long long
#define pll pair<long, long>
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define ff first
#define ss second
#define pb push_back
#define db pop_back
#define mp make_pair
#define mt make_tuple
#define g(a, b) get<a>(b)
#define INF (ll)1e18 + 100
#define vl vector<ll>
#define vi vector<int>
#define vll vector<pair<ll, ll>>
#define vii vector<pair<int, int>>
#define all(v) v.begin(),v.end()
#define bset(a, p) ((a) | (1ll << (p)))
#define bchk(a, p) ((a) & (1ll << (p)))
#define bxor(a, p) ((a) ^ (1ll << (p)));
#define brem(a, p) (bchk(a, p) ? (bxor(a, p)) : (a))
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

ll modI(ll a, ll m);
ll gcd(ll a, ll b);
ll powM(ll x, unsigned ll y, unsigned ll m);
void pairsort(int a[], int b[], int n);
void pairsortll(ll a[],ll b[],ll n);
ll logint(ll x,ll y);
 
 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}
 
ll powM(ll x,ll y,ll m)
{
    if(y==0) return 1;
    ll p=powM(x,y/2,m)%m;
    p=(p*p)%m;
    return (y%2==0)?p:(x*p)%m;
}
 
ll modI(ll a, ll m)
{
   return powM(a, m-2, m);
}
 
void pairsort(int a[],int b[],int n)
{
    pair<int,int> v[n];
    REP(i,0,n)
    {
        v[i].ff=a[i];
        v[i].ss=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].ff;
        b[i]=v[i].ss;
    }
}
 
void pairsortll(ll a[],ll b[],ll n)
{
    pair<ll,ll> v[n];
    REP(i,0,n)
    {
        v[i].ff=a[i];
        v[i].ss=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].ff;
        b[i]=v[i].ss;
    }
}
 
ll logint(ll x,ll y)
{
    ll ans=0;
    ll a=1;
    for(ll i=0;i<=x;i++)
    {
        if(x<a)
        {
            return ans;
        }
        ans++;
        a*=y;
    }
    return -1;
}
const int N = 2e5+5;
//vector<ll>v(N, 0);
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //Hey, You
    // Don't practise these
    // easy questions.
    int a , b;
    cin>>a>>b;
    cout<<(a^b);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, K, A[201010], B[201010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> K;
	rep(i, 0, N) cin >> A[i];

	rep(k, 0, K) {
		rep(i, 0, N) B[i] = 0;
		rep(i, 0, N) {
			int L = max(0, i - A[i]);
			int R = min(N - 1, i + A[i]);

			B[L]++;
			B[R + 1]--;
		}
		rep(i, 1, N) B[i] += B[i - 1];

		bool same = true;
		rep(i, 0, N) {
			if (A[i] != B[i]) same = false;
			A[i] = B[i];
		}

		if (same) break;
	}

	rep(i, 0, N) {
		if(i) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}







Measured memory_bytes: 5340
#include<iostream>
#include<algorithm>
using namespace std;
struct People
{
	int id1;
	int value;
	bool operator<(const People&p)const
	{
		return id1<p.id1;
	}
}A[100005];
int main()
{
	int N;
	cin>>N; 
	for(int i=1;i<=N;i++)
	{
		cin>>A[i].id1;
		A[i].value=i;
	}
	sort(A+1,A+N+1);
	for(int i=1;i<=N;i++)
	{
		cout<<A[i].value<<" ";
	}
	return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>
#include <string.h>
#include <string>
#include <map>
using namespace std;
#define TT 35

map <string, int> S;

int max_len,  max_time;
char str[TT], tmp_max_len[TT], tmp_max_time[TT];

void init(){
	max_len = 0,  max_time = 0;
}

void solve(){
	S[str] ++;
	if (max_time < S[str]){
		strcpy(tmp_max_time, str);
		max_time = S[str];
	}
	int len = strlen(str);
	if (max_len < len){
		strcpy(tmp_max_len, str); 
		max_len = len;
	}
}

int main (){
	init();
	while (~scanf("%s", str)){
		solve();
	}
	printf("%s %s\n", tmp_max_time, tmp_max_len);
	return 0;
}

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

int main(){

	string str;

	while(1){
		cin >> str;
		if(str == "-") break;

		int m;
		cin >> m;

		for(int i = 0; i < m; i++){
			int h;
			cin >> h;
			str = str.substr(h, str.length() - h) + str.substr(0, h);
		}
		cout << str << endl;
	}

	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define ms(v,x) memset(v,x,sizeof(v))
#define pii pair<int,int>
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define rep(i,j,k) for(int i=j;i<k;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define M   1000000007 // 1e9 + 7
using namespace std;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int exp(int a,int b,int m){
    if(b==0) return 1LL;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}
main(){
    fastio;
    int n;
    cin >> n;
    cout << n * n << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define ins insert
#define er erase
#define f(i,a,b) for(i=a;i<b;++i)
#define rf(i,a,b) for(i=a;i>=b;--i)
#define tc int t;cin>>t;while(t--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int> 
#define vll vector<ll> 
#define vull vector<ull>
#define vc vector<char>
#define vst vector<string>
#define bs bitset
#define mp make_pair
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b) 
#define lb lower_bound
#define ub upper_bound
#define nl "\n" 
#define sp " "
using namespace std;

//LET'S PLAY THE GAME!!

int main(){
    fast;
    
    int n,l;cin>>n>>l;
    
    int fl=n*l + (n*(n-1))/2 ;
    if(l>=0)fl-=l;
    else if(l<=-n)fl-=(l+n-1);
    cout<<fl;
    
    return 0;
}
// AND THE GAME IS OVER!!

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

using namespace std;

int q[110];

int main(){
	
    int n;
    cin >> n;
    
    for(int i = 1; i <= n; i ++) cin >> q[i];
    
    int js = 0;
    for(int i = 1; i <= n; i ++){
    	if( (i & 1) &&  (q[i] & 1)) js++;
    }
    
    cout << js << endl;
    
    return 0;
}

Measured memory_bytes: 3564
#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while(x!=NIL){
    y=x;
    if(z->key < x->key)
      x=x->left;
    else
      x=x->right;
  }
 
  z->parent=y;
 
  if(y==NIL)
    root=z;
  else if(z->key < y->key)
    y->left=z;
  else
    y->right=z;
 
 
}
 
void inorder(Node x){
  if(x!=NIL){
    inorder(x->left);
    printf(" %d",x->key);
    inorder(x->right);
  }
}
 
void preorder(Node x){
  if(x!=NIL){
    printf(" %d",x->key);
    preorder(x->left);
    preorder(x->right);
  }
   
}

int Find(Node x, int k){
  while( x != NIL && k != x->key){
    if(k < x->key)
      x = x->left;
    else
      x = x->right;
  }
  if(x == NIL)return 0;
  else return 1;
}

 
int main(){
  int n, i, x;
  char com[20];

  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'f' ){
      scanf("%d",&x);
      if(Find(root,x)==0)printf("no\n");
      else printf("yes\n");
    }
    
  }

 
  return 0;
}

Measured memory_bytes: 19364
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			int D = scan.nextInt();
			int T = scan.nextInt();
			int S = scan.nextInt();

			if(D<=T*S) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}


		}


	}


}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}



template<uint32_t mod>
struct ModInt{
	uint32_t a;
	ModInt& s(uint32_t vv){
		a=vv<mod?vv:vv-mod;
		return *this;
	}

    ModInt(int64_t x=0){s(x%mod+mod);}

	ModInt& operator+=(const ModInt &x){return s(a+x.a);}
	ModInt& operator-=(const ModInt &x){return s(a+mod-x.a);}
	ModInt& operator*=(const ModInt &x){
		a=uint64_t(a)*x.a%mod;
		return *this;
	}
	ModInt& operator/=(const ModInt &x){
		*this*=x.inv();
		return *this;
	}

	ModInt operator+(const ModInt &x)const{return ModInt(*this)+=x;}
	ModInt operator-(const ModInt &x)const{return ModInt(*this)-=x;}
	ModInt operator*(const ModInt &x)const{return ModInt(*this)*=x;}
	ModInt operator/(const ModInt &x)const{return ModInt(*this)/=x;}
	bool operator==(const ModInt &x)const{return a==x.a;}
	bool operator!=(const ModInt &x)const{return a!=x.a;}
	bool operator<(const ModInt &x)const{return a<x.a;}

	ModInt operator-()const{return ModInt()-*this;}
	ModInt pow(int64_t n)const{
		ModInt res(1),x(*this);
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}

    ModInt inv()const{return pow(mod-2);}
};

template<uint32_t mod>
istream& operator>>(istream& in,ModInt<mod>& a){
	return (in>>a.a);
}
template<uint32_t mod>
ostream& operator<<(ostream& out,const ModInt<mod>& a){
	return (out<<a.a);
}
using mint=ModInt<998244353>;
const int LIM=3000;

int N,S;
int A[3333];

mint dp[3333];

signed main(){
	cin>>N>>S;
	rep(i,N)cin>>A[i];

	dp[0]=1;
	rep(i,N){
		for(int j=LIM;j>=0;j--){
			if(j+A[i]<=LIM)dp[j+A[i]]+=dp[j];
			dp[j]*=2;
		}
	}

	cout<<dp[S]<<endl;
    return 0;
}


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

cnt=0
def dfs(u):
  global cnt
  global visited
  visited[u]=True
  for v in edges[u]:
    if visited[v]==False:
      dfs(v)
  if all(visited):
    return 0
  else:
    return 1
ab=[]
for i in range(m):
  a,b=map(int,input().split())
  edges[a-1].append(b-1)
  edges[b-1].append(a-1)
  ab.append([a,b])
for i in range(m):
  visited=[False]*n
  a,b=ab[i]
  edges[a-1].remove(b-1)
  edges[b-1].remove(a-1)
  cnt+=dfs(0)
  edges[a-1].append(b-1)
  edges[b-1].append(a-1)
print(cnt)

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    while (cin >> n, n) {
        vector<string> name(n); cin >> name;
        map<string, ll> cnt;
        rep(i, n) {
            cnt[name[i]]++;
            ll M = 0;
            map<ll, vector<string>> m;
            each(p, cnt) {
                m[-p.second].pb(p.first);
            }
            pair<string,ll> p{m.begin()->second[0], -m.begin()->first};
            each(pp, cnt) {
                if (pp.first != p.first) {
                    chmax(M, pp.second);
                }
            }
            if (p.second > n-i-1+M) {
                cout << p.first << " " << i+1 << endl;
                break;
            }
        }
        map<ll, vector<string>> m;
        each(p, cnt) {
            m[-p.second].pb(p.first);
        }
        vector<string> winner = m.begin()->second;
        if (winner.size() > 1) {
            cout << "TIE" << endl;
        }
    }
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define INF 1000000000000001
#define ll long long
using namespace std;

int main()
{
  string a;
  cin >> a;
  if (a[2] == a[3] && a[4] == a[5])
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
int main(){
	ll N;
	cin >> N;
	vl A(N+1);
	vl B(N);
	REP(i, N+1){
		cin >> A[i];
	}
	REP(i, N){
		cin >> B[i];
	}
	ll ans = 0;
	REP(i, N){
		if(A[i] > B[i]){
			ans += B[i];
			A[i] = A[i] - B[i];
		} else {
			ans += A[i];
			if(A[i + 1] > (B[i] - A[i])){
				A[i + 1] = A[i + 1] - (B[i] - A[i]);
				ans += B[i] - A[i];
			} else{
				ans += A[i + 1];
				A[i + 1] = 0;
			}
			A[i] = 0;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
int main()
{   int N,A,B;
    while(~scanf("%d",&N))
    {
         if(N==1)
    {
        printf("Hello World\n");
    }
         if(N==2)
       {
        scanf("%d%d",&A,&B);
        printf("%d\n",A+B);
       }
    }
return 0;
}


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

int main(){
  string S2;
  int Q;
  cin >> S2 >> Q;
  
  int rev = 0;
  string S1="",S3="";
  for(int i=0;i<Q;i++){
    int t;
    cin >> t;
    if(t==1) rev = (rev+1)%2;
    if(t==2){
      int f;
      char c;
      cin >> f >> c;
      if((f+rev)%2==1) S1 += c;
      else S3 += c;
    }
  }
  
  if(rev==1){
    reverse(S2.begin(),S2.end());
    reverse(S3.begin(),S3.end());
    cout << S3 << S2 << S1 << endl;
  }
  else{
    reverse(S1.begin(),S1.end());
    cout << S1 << S2 << S3;
  }
  return 0;
}


Measured memory_bytes: 1088
# -*- coding: utf-8 -*-

import sys
import os

def solve(island):
    visited = []
    for lst in island:
        visit_row = []
        for c in lst:
            if c == '1':
                visit_row.append(False)
            else:
                visit_row.append(True)
        visited.append(visit_row)

    def paintable(x, y):
        if 0 <= x < 12 and 0 <= y < 12 and not visited[x][y]:
            return True
        else:
            return False

    def paint(x, y, number):
        visited[x][y] = True
        island[x][y] = number
        if paintable(x-1, y):
            paint(x-1, y, number)

        if paintable(x+1, y):
            paint(x+1, y, number)

        if paintable(x, y-1):
            paint(x, y-1, number)

        if paintable(x, y+1):
            paint(x, y+1, number)

    paint_id = 2

    for i in range(12):
        for j in range(12):
            if paintable(i, j):
                paint(i, j, paint_id)
                paint_id += 1

    line = []
    for lst in island:
        line += lst

    line = set(line)
    if '0' in lst:
        line.remove('0')

    print(len(line))

for s in sys.stdin:
    s = s.strip()
    if s != '':
        island = [list(s)]
        for i in range(11):
            s = input().strip()
            island.append(list(s))
        solve(island)
    else:
        island = []
        pass

Measured memory_bytes: 7492
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        List<String[]> list = new ArrayList<>();
        int count = 0;
        int N = 0;
        int M = 0;

        while (scan.hasNext()) {
            if (count == 0) {
                N = scan.nextInt();
                M = scan.nextInt();
                count++;
                continue;
            }
            String str = scan.nextLine();
            String[] sp = str.split(" ");
            list.add(sp);
            count++;
            if (count > N + 1) {
                break;
            }
        }


        int result[] = new int[30];
        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= Integer.valueOf(list.get(i)[0]); j++) {
                result[Integer.valueOf(list.get(i)[j]) - 1]++;
            }
        }

        int resultCount = 0;
        for (int r : result) {
            if (r == N) {
                resultCount++;
            }
        }
        System.out.print(resultCount);
    }
}


Measured memory_bytes: 23764
#include<iostream>

using namespace std;

int main(){
  int S;
  int h,m,s;
  
  cin >>S;

  //時間
  h = S/3600;

  //余りを商に
  m = (S % 3600) /60;

  s = S%60;

    cout << h<< ":"<< m<< ":"<<s <<endl; 
  return 0;
}



Measured memory_bytes: 3096
<?php
// perl -le 'print "str" x n'
// 1 <= N <= 3000
// 1 <= S <= 3000
// 1 <= A <= 3000
// N S
// A1 A2 AN
// 998244353 のあまり
// 536870912
// echo (2**29).PHP_EOL;
// 1073741824
// echo (2**30).PHP_EOL;

$powmap = [];
(function () use (&$powmap) {
    for ($i = 0; $i < 60; $i++) {
        $powmap[$i] = (2**$i)%998244353;
    }
    for ($i = 60; $i <= 3000; $i++) {
        $powmap[$i] = ($powmap[$i-1]*2)%998244353;
    }
})();

(function () use ($powmap) {
    $stdin = trim(fgets(STDIN));
    list($N, $S) = explode(' ', $stdin, 2);
    $N = intval($N);
    $S = intval($S);

    $stdin = trim(fgets(STDIN));
    $A = explode(' ', $stdin);

    // $A = array_filter($A, function ($v) use ($S) {
    //     return $S>=$v;
    // });
    $N = count($A);
    rsort($A);
    (function () use ($A) {
        $num = 0;
        foreach ($A as $v) {
            $num += $v;
            if ($num >= $S) {
                return;
            }
        }
        echo 0;
        exit;
    })();
    sort($A);

    $total = 0;

    $map = [];
    foreach ($A as $i => $av) {
        foreach ($map as $mp => $mv) {
            if ($mp + $av <= $S) {
                $map[$mp + $av] += $mv;
            }
            $map[$mp] = ($mv * 2)%998244353;
        }
        $map[$av] += $powmap[$i];
        krsort($map);
        // var_dump([$av, $map]);
    }

    $total = $map[$S];
    echo ($total%998244353).PHP_EOL;
})();
// 1<=e1<=e2<=e3
// f({e1}) = {e1} = 0
// f({e2}) = {e2} = 0
// f({e3}) = {e3} = 1
// f({e1,e2}) => {e1}+{e2}+{e1,e2} = 0,0,1 = 1
// f({e1,e3}) => {e1}+{e3}+{e1,e3} = 0,1,0 = 1
// f({e2,e3}) => {e2}+{e3}+{e2,e3} = 0,1,0 = 1
// f({e1,e2,e3}) => {e1}+{e2}+{e3}+{e1,e2}+{e1,e3}+{e2,e3}+{e1,e2,e3} = 0,0,1,1,0,0,0=2

// {e1}<{e1,e2},{e1,e3},{e2,e3},{e1,e2,e3}
// {e2}<{e1,e2},{e1,e3},{e2,e3},{e1,e2,e3}
// {e3}<{e1,e3},{e2,e3},{e1,e2,e3}
// {e1,e2}<={e1,e3},{e2,e3}
// {e1,e2}<{e1,e2,e3}
// {e1,e3}<={e2,e3}
// {e1,e3}<{e1,e2,e3}
// {e2,e3}<{e1,e2,e3}

// {e1}<{e1,e2},{e1,e3},{e2,e3},{e1,e2,e3}
// {e2}<{e1,e2},{e1,e3},{e2,e3},{e1,e2,e3}
// {e3}<{e1,e3},{e2,e3},{e1,e2,e3}
// {e1,e2}<={e1,e3},{e2,e3}
// {e1,e2}<{e1,e2,e3}
// {e1,e3}<={e2,e3}
// {e1,e3}<{e1,e2,e3}
// {e2,e3}<{e1,e2,e3}


Measured memory_bytes: 16828
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> paper(h);
    for(auto&& i : paper){
        cin >> i;
    }
    const int dx[] = {0, -1, 0, 1};
    const int dy[] = {1, 0, -1, 0}; 
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(paper[i][j] == '#'){
                bool finish = true;
                for(int k = 0; k < 4; k++){
                    if(i + dx[k] < 0 || i + dx[k] == h || j + dy[k] < 0 || j + dy[k] == w){
                        continue;
                    }
                    if(paper[i + dx[k]][j + dy[k]] == '#'){
                        finish = false;
                        break;
                    }
                }
                if(finish){
                    cout << "No\n";
                    return 0;
                }
            }
        }
    }
    cout << "Yes\n";
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<int,int>;

const int MOD = 1e9 + 7;

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

    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    ll i, j, k;
    i = c * max(x, y) * 2;
    j = a * x + b * y;
    k = c * min(x, y) * 2;
    if(x > y){
        k += a * abs(x-y);
    }else{
        k += b * abs(x-y);
    }

    cout << min(i, min(j, k)) << endl;

    return 0;
}


Measured memory_bytes: 256
a, b = map(int, input().split())
if a + b != 0 and (a + b) % 3 == 0:
  print("Possible")
elif a != 0 and a % 3 == 0:
  print("Possible")
elif b != 0 and b % 3 == 0:
  print("Possible")
else:
  print("Impossible")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)
#define all(v) v.begin(), v.end()
#define rall(x) (x).rbegin(), (x).rend()
#define pll pair<long long, long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vc vector<char>
#define vvc vector<vc>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
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;}
//snippets:tmp,cl,cvl,cs,co,coy,con,cov,setp

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a;
    cin >> a;
    ll b;
    cin >> b;
    ll c;
    cin >> c;
    ll k;
    cin >> k;
    rep(i,k){
        if(a>=b){
            b*=2;
        }else{
            c*=2;
        }
        if(a<b&&b<c){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
string u = "ATGC";
int main() {
    string s; cin >> s;
    int ans = 0;
    for (int i = 0; i < s.size(); i++) {
        int tmp = 0;
        for (int j = i; j < s.size(); j++) {
            bool flag = false;
            for (int k = 0; k < 4; k++) {
                if (u[k] == s[j]) {
                    flag = true;
                    tmp++;
                }
            }
            if (!flag) break;
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main(void){
  int n, found;
  long y;
  
  scanf("%d%ld", &n, &y);
  found = 0;
  for (int i=0; i<=n; i++){
    for (int j=0; j<=n-i; j++){
      int k = n-i-j;
      if (i*10000 + j*5000 + k*1000 == y && !found){
        found = 1;
        printf("%d %d %d\n", i, j, k);
      }
    }
  }
  if (found==0){
    puts("-1 -1 -1");
  }
  
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
#define endl '\n'
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
const int nax = 307;
int n;
vector<vector<ll>>dis(nax, vector<ll>(nax));
vector<vector<bool>>is(nax, vector<bool>(nax));
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> dis[i][j];
		}
	}
	bool ok = false;
	for (int k = 0; k < n; k++) {
		for (int  i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (dis[i][j] > dis[i][k] + dis[k][j]) {
					ok = true;
					break;
				}
				if (dis[i][j] == dis[i][k] + dis[k][j] && i != k && j != k) {
					is[i][j] = true;
				}
			}
		}
		if (ok)break;
	}
	if (ok)
		cout << "-1" << endl;
	else {
		ll ans = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (!is[i][j])ans += dis[i][j];
			}
		}
		cout << ans / 2 << endl;
	}
}

Measured memory_bytes: 4412