akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int num[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
bool uru(int checkyear){if(checkyear%4==0){if(checkyear%100!=0||checkyear%400==0)return true;}return false;}
int gcd( int x, int y ){return y ? gcd(y, x%y) : x;}
signed main()
{
int x=0,y=0,z=0,w=0,n=0,m=0;
std::cin >> x>>y>>z;
if(x==5&&y==5&&z==7)std::cout << "YES" << '\n';
else if(x==5&&y==7&&z==5) std::cout << "YES" << '\n';
else if(x==7&&y==5&&z==5) std::cout << "YES" << '\n';
else std::cout << "NO" << '\n';
}


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

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

bool check(long long x){
  int n=sqrt(x);
  bool ok=true;
  for(int i=2;i<n;i++){
    if(x%i==0)	ok=false;
  }
  return ok;
}

int main() {
  long long x;	cin >> x;
  while(1){
    if(check(x))	break;
    x++;
  }
  cout << x;
}


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




int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL); 
    long long int n;
    cin>>n;
    long long sum=0;
    for(int i=1;i<=n;i++){
        long long int f=n/i;
        sum+=i*(f*(f+1))/2;
    }
    cout<<sum;
  
  
}
  
    






Measured memory_bytes: 3632
fun solve(input: String): Long {
    val len = input.length 
 
    val red_list: MutableList<Int> = mutableListOf()
    val green_list: MutableList<Int> = mutableListOf()
    val blue_list: MutableList<Int> = mutableListOf()

    (0 until len).forEach { 
        when(input[it]) {
            'R' -> {
                red_list.add(it)
            }
            'G' -> {
                green_list.add(it)
            }
            'B' -> {
                blue_list.add(it)
            }
            else -> {}
        }
    }
    assert(red_list.size + green_list.size + blue_list.size == len)
    val first_matched = red_list.size.toLong() * green_list.size.toLong() * blue_list.size.toLong()
    var diff = 0L
    for(i in 0 until len) {
        for(j in (i + 1) until len) {
            val k = 2 * j - i
            diff += if(k < len && input[i] != input[j] && input[j] != input[k] && input[i] != input[k])  { 1 } else {0}
        }
    }

    return first_matched - diff
} 


fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val S = readLine()!!
    assert(S.length == N)
 
    solve(S).run(::println)
}

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

int main(){
    string s;
    cin >> s;
    for(int i = 1; i < s.size(); i++){
        if(s[i-1] == s[i]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var k, a, b int
	fmt.Scan(&k, &a, &b)

	for i := a; i <= b; i++ {
		if i%k == 0 {
			fmt.Println("OK")
			return
		}
	}
	fmt.Println("NG")
}


Measured memory_bytes: 1756
<?php
  fscanf(STDIN, "%d%d%d", $a, $b, $c);
  if($a <= $b){
    echo 1;
  }elseif($c >= $b){
    echo -1;
  }else{
    $a -= $b;
    printf("%d", max(0, intdiv($a+$b-$c-1,$b-$c)*2+1));
  }

Measured memory_bytes: 4728
import math
A, B = map(int, input().split())
A_min = A / 0.08
A_max = (A + 1) / 0.08
B_min = B / 0.1
B_max = (B + 1) / 0.1

for i in range(1, 1001):
  if int(i * 0.08) == A and int(i * 0.1) == B:
    print(i)
    exit()
print(-1)

Measured memory_bytes: 62304
n, k, q = gets.split.map(&:to_i)
ans = Array.new(n)
q.times {
  a = gets.to_i - 1
  ans[a] = ans[a].nil? ? 1 : ans[a] + 1
}
ans.each { |a| puts (k - 1 * (q - (a || 0))).positive? ? 'Yes' : 'No' }

Measured memory_bytes: 3196
import sys
def main():
    N = int(sys.stdin.readline())
    A = [int(sys.stdin.readline()) for i in range(N)]
    maxa = max(A)
    if A.count(maxa) > 1:
        for i in range(N):
            print(maxa)
    else:
        for i in range(N):
            if A[i] != maxa:
                print(maxa)
            else:
                print(sorted(A)[-2])
                
main()

Measured memory_bytes: 14216
#include<stdio.h>
#define NUMBER 3000
int main(void)
{
    int x[NUMBER],y[NUMBER],tmp,i,N=0;
    for(i=0;i<NUMBER;i++){
         scanf("%d %d",&x[i],&y[i]);
         if(x[i]==0 && y[i]==0){break;
         }
         N++;
         if(x[i]>y[i]){
             tmp=y[i];
             y[i]=x[i];
             x[i]=tmp;
         }
    }
   
   for(i=0;i<N;i++){
       printf("%d %d\n",x[i],y[i]);
   }

return 0;
}


Measured memory_bytes: 2644
using System;


namespace ConsoleApplication3
{
   class Program
    {
        static void Main(string[] args)
        {
        //???????°???°?????????????????????double
        double r = double.Parse(Console.ReadLine());
        //??¢???????¨????
        double equivalent = 3.141592653589 * Math.Pow(r, 2);

        //string???????????????????????§??¨???
        string a = equivalent.ToString("F6");
        //??¨?????????????¨??????????
        double around = 2 * 3.141592653589 * r;

        //string??????????????????????????§??¨???
        string b = around.ToString("F6");

        Console.WriteLine(a + " " + b);
    }
}
}

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

int main() {
  int D,G; cin >> D >> G;
  int p[11],c[11];
  for ( int i = 0; i < D; i++ ) {
    cin >> p[i] >> c[i];
  }
  int ans = 1e9;
  for ( int bit = 0; bit < (1<<D); bit++ ) {
    int s = 0,rest_max,num = 0;
    for ( int i = 0; i < D; i++ ) {
      if( bit & (1<<i) ) {
	s += p[i]*(i+1)*100+c[i];
	num += p[i];
      } else {
	rest_max = i;
      }
    }
    if ( s < G ) {
      int tmp = (rest_max+1)*100;
      int need = (G-s+tmp-1)/tmp;
      if ( need > p[rest_max]-1 ) {
	continue;
      }
      num += need;
    }
    ans = min(ans,num);
    
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
using namespace std;
int N,M;
int fie[21][21];
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
map<char,int> m;
main(){
  m['N']=0;
  m['E']=1;
  m['S']=2;
  m['W']=3;
  while(1){
    scanf("%d",&N);
    if(N==0) break;
    memset(fie,0,sizeof(fie));
    for(int i=0;i<N;i++){
      int x,y;
      //      scanf("%d %d",&x,&y);
      cin >> x >> y;
      fie[x][y]=1;
    }
    fie[10][10]=0;
    scanf("%d",&M);
    int X=10,Y=10;
    for(int i=0;i<M;i++){
      char d;
      int o;
      cin >> d >> o;
      for(int j=0;j<o;j++){
	X+=dx[m[d]];
	Y+=dy[m[d]];
	//	cout << X << " " << Y << ":"<<fie[X][Y]<<endl;
	fie[X][Y]=0;
      }
    }
    
    bool f=true;
    for(int i=0;i<21;i++)
      for(int j=0;j<21;j++)
	if(fie[j][i]) f=false;
    if(f) puts("Yes");
    else puts("No");
  }
}

Measured memory_bytes: 1208
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  ll X, Y, Z, K; cin >> X >> Y >> Z >> K;
  vector<ll> A(X); rep(i,X) cin >> A[i];
  vector<ll> B(Y); rep(i,Y) cin >> B[i];
  vector<ll> C(Z); rep(i,Z) cin >> C[i];
  sort(rall(A));
  sort(rall(B));
  sort(rall(C));
  vector<ll> rank;
  rep(x,X){
    rep(y,Y){
      rank.pb(A[x]+B[y]);
    }
  }
  sort(rall(rank));
  rank.resize(K);
  vector<ll> rank2;
  rep(k,K){
    rep(z,Z){
      rank2.pb(rank[k]+C[z]);
    }
  }
  sort(rall(rank2));
  rep(i,K) cout << rank2[i] << '\n';
  return 0;
}


Measured memory_bytes: 42984
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int m = Integer.parseInt(scan.next());
        int q = Integer.parseInt(scan.next());
        int[][] train = new int[n][n];
        for (int i = 0; i < m; i++) {
            int l = Integer.parseInt(scan.next());
            int r = Integer.parseInt(scan.next());
            l--;
            r--;
            train[l][r]++;
        }

        for (int i = 0; i < n; i++) {
            for (int j = i; j < n - 1; j++) {
                train[i][j + 1] += train[i][j];
            }
        }

        for (int i = 0; i < q; i++) {
            int l = Integer.parseInt(scan.next());
            int r = Integer.parseInt(scan.next());
            l--;
            r--;

            int ans = 0;
            for (int j = l; j <= r; j++) {
                ans += train[j][r];
            }
            System.out.println(ans);
        }
        scan.close();

    }
}


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

#define pb push_back
#define pf push_front
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second
#define next _next
#define prev _prev
#define left _left
#define right _right
#define y1 _y1
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = (int)1e6 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;

void megaRandom() {
	unsigned int FOR;
 	asm("rdtsc" : "=A"(FOR));
  srand(FOR);
}

ll a, b, c;

int main() {
	megaRandom();
	cin >> a >> b >> c;
	if((a == 1 && (b != c)) || b > c) {
		cout << 0;
		return 0;	
 	}
 	cout << (c - b) * (a - 2) + 1;
	return 0;         
}


Measured memory_bytes: 256
S=list(input())
ans=[0]*len(S)
r=0
for n in range(len(S)):
    if S[n]=='R':
        r=r+1
    else:
        if r>0:
            if r%2==0:
                ans[n]=round(r/2)
                ans[n-1]=round(r/2)
            else:
                ans[n]=round((r-1)/2)
                ans[n-1]=round((r+1)/2)
            r=0

l=0
for n in range(len(S)):
    i=len(S)-1-n
    if S[i]=='L':
        l=l+1
    else:
        if l>0:
            if l%2==0:
                ans[i]=ans[i]+round(l/2)
                ans[i+1]=ans[i+1]+round(l/2)
            else:
                ans[i]=ans[i]+round((l-1)/2)
                ans[i+1]=ans[i+1]+round((l+1)/2)
            l=0
for n in range(len(S)):
    ans[n]=str(ans[n])
print(' '.join(ans))


Measured memory_bytes: 10868
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	ll a = fetch<ll>();
	ll b = fetch<ll>();
	ll c = fetch<ll>();
	ll k = fetch<ll>();

	cout << (k & 1 ? b - a : a - b) << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 256
N, C = map(int, input().split())
D = [[]]
for _ in range(C):
    di = [0] + [int(s) for s in input().split()]
    D.append(di)
c = []
for _ in range(N):
    ci = [int(s) for s in input().split()]
    c.append(ci)

cnt = [[0] * (C + 1) for _ in range(3)]
for i in range(N):
    for j in range(N):
        cnt[(i + j) % 3][c[i][j]] += 1

ans = float("inf")
for c0 in range(1, C + 1):
    for c1 in range(1, C + 1):
        for c2 in range(1, C + 1):
            if c0 == c1 or c1 == c2 or c2 == c0:
                continue
            d = 0
            d += sum(cnt[0][v] * D[v][c0] for v in range(1, C + 1))
            d += sum(cnt[1][v] * D[v][c1] for v in range(1, C + 1))
            d += sum(cnt[2][v] * D[v][c2] for v in range(1, C + 1))
            ans = min(ans, d)
print(ans)


Measured memory_bytes: 5364
from copy import *
from bisect import *
N,Q=map(int,input().split())
P=(N-2)*(N-2)
X=[N-2]
Y=[N-2]
V=[]
W=[]
a,b,c=0,0,0
for i in range(Q):
  a,b=map(int,input().split())
  b=N-b
  if a==1:
    c=bisect_left(V,b)
    if c==len(V):
      P-=Y[c]
      Y.append(Y[-1])
      X[-1]=N-b-2
      V.append(b)
    else:
      P-=Y[c]
  else:
    c=bisect_left(W,b)
    if c==len(W):
      P-=X[c]
      X.append(X[-1])
      Y[-1]=N-b-2
      W.append(b)
    else:
      P-=X[c]
print(P)


Measured memory_bytes: 98524
package main

	import (
		"bufio"
		"fmt"
		"math"
		"os"
		"strconv"
	)

	const pi = math.Pi

	var mod int = pow(10, 9) + 7
	var Umod uint64 = 1000000007
	var ans, cnt int

	func main() {
		reader.Split(bufio.ScanWords)
		A, _ := strconv.Atoi(read())
		B, _ := strconv.Atoi(read())

		// A-K, B-K
		// K-A, B-K
		// A-K, K-B
		// K-A, K-B

		K1 := (A - B) / 2
		K2 := (A + B) / 2

		if abs(A-K1) == abs(B-K1) {
			fmt.Println(K1)
		} else if abs(A-K2) == abs(B-K2) {
			fmt.Println(K2)
		} else {
			fmt.Println("IMPOSSIBLE")
		}
	}

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

	var reader = bufio.NewScanner(os.Stdin)

	func read() string {
		reader.Scan()
		return reader.Text()
	}

	func lcm(x, y int) int {
		return (x / gcd(x, y)) * y
	}

	func gcd(x, y int) int {
		if x%y == 0 {
			return y
		} else {
			r := x % y
			return gcd(y, r)
		}
	}

	var fac [1000000]int
	var finv [1000000]int
	var inv [1000000]int

	func combination_init() {
		fac[0], fac[1] = 1, 1
		finv[0], finv[1] = 1, 1
		inv[1] = 1

		// invは a^(-1) mod p
		// pをaで割ることを考える

		// p/a*(a) + p%a = p
		// p/a*(a) + p%a = 0          (mod p)
		// -p%a = p/a*(a)             (mod p)
		// -p%a *a^(-1)= p/a          (mod p)
		// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
		// a^(-1) =

		for i := 2; i < 1000000; i++ {
			fac[i] = fac[i-1] * i % mod
			inv[i] = mod - inv[mod%i]*(mod/i)%mod
			finv[i] = finv[i-1] * inv[i] % mod
		}
	}

	func combination(x, y int) int {
		if x < y {
			return 0
		}
		if fac[0] != 1 {
			combination_init()
		}
		return fac[x] * (finv[y] * finv[x-y] % mod) % mod
		//return fac[x] / (fac[y] * fac[x-y])
	}

	func permutation(x, y int) int {
		if x < y {
			return 0
		}
		if fac[0] != 1 {
			combination_init()
		}
		return fac[x] * (finv[x-y] % mod) % mod
		//return fac[x] / fac[x-y]
	}

	func max(x ...int) int {
		var res int = x[0]
		for i := 1; i < len(x); i++ {
			res = int(math.Max(float64(x[i]), float64(res)))
		}
		return res
	}

	func min(x ...int) int {
		var res int = x[0]
		for i := 1; i < len(x); i++ {
			res = int(math.Min(float64(x[i]), float64(res)))
		}
		return res
	}
	func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
	func abs(x int) int    { return int(math.Abs(float64(x))) }
	func floor(x int) int  { return int(math.Floor(float64(x))) }
	func ceil(x int) int   { return int(math.Ceil(float64(x))) }

	type SortBy [][]int

	func (a SortBy) Len() int           { return len(a) }
	func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
	func (a SortBy) Less(i, j int) bool { return a[i][0] < a[j][0] }

	type PriorityQueue []int

	func (h PriorityQueue) Len() int            { return len(h) }
	func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
	func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
	func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
	func (h *PriorityQueue) Pop() interface{} {
		old := *h
		n := len(old)
		x := old[n-1]
		*h = old[0 : n-1]
		return x
	}


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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef uint64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

int main()
{
	
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	VI a(n), b0,b1;
	rep(i,n) cin >>a[i];
	
	b0.reserve(n); b1.reserve(n);
	rep(i,n){
		if(i%2==0) b0.push_back(a[i]);
		else b1.push_back(a[i]);
	}
	
	
	if(n%2==0){
		reverse(all(b1));
		rep(i,sz(b0)) b1.push_back(b0[i]);
		rep(i,n) printf("%s%d",(i? " ":""),b1[i]);
		printf("\n");
	}else{
		reverse(all(b0));
		rep(i,sz(b1)) b0.push_back(b1[i]);
		rep(i,n) printf("%s%d",(i? " ":""),b0[i]);
		printf("\n");
	
	}
	
	return 0;
}


Measured memory_bytes: 4096
#include<iostream>
#include<math.h>
#include<stdlib.h>

using namespace std;

int main(){
	int n;
	cin >> n;
	int bh,h;
	bh = 0;
	int ans = 0;
	for(int i = 0;i < n;i++){
		cin >> h;
		if(bh <= h)ans++;
		bh = max(bh,h);
	}
	cout << ans << endl;
	return 0;
}

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

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

    string s, p;
    cin >> s;
    cin >> p;
    s += s;
    
    if (s.find(p) != string::npos) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3224
#include <iostream>
#include<cstdio>
#include<stdio.h>
using namespace std;

int main() {
	int h[100], w[100];
	int count = 0;
	while (true) {
		cin >> h[count];
		cin >> w[count];
		if (h[count] == 0 && w[count] == 0) {
			break;
		}
		count++;
	}
	
	for(int a =0;a<count;a++){

		for (int i = 0; i < h[a]; i++) {
			for (int j = 0; j < w[a]; j++) {
				cout << '#';
			}
			cout << endl;
		}
		cout << endl;
	}

	

	return 0;
}



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

#define f first
#define s second
#define pb push_back
#define mp make_pair

using namespace std;

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

const int N = (int)2e5 + 123, inf = 1e9, mod = 1e9 + 7;
const ll INF = 1e18;

int main()
{
	string s;
	int x;
	cin >> s;
	for(int i = 0; i < s.size(); i++)
		if(s[i] == 'x')
			x++;
	if(x >= 8)     
		puts("NO");
	else
		puts("YES");
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int w = sc.nextInt();
		int a = sc.nextInt();
		int b  = sc.nextInt();
		
		int c;

		if(a>b){
			c=a;
			a=b;
			b=c;
		}

		if(a+w>=b){
			System.out.println("0");
		}else{
			System.out.println(b-a-w);
		}
		
	}

}


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

int main(){
    ll x;
    cin>>x;
    int d=0;
//    ll interest = 1;
    ll amnt = 100;
    while((amnt) < x){
        d++;
//        interest *= 1.01;
        amnt *= 1.01;
    }
    cout<<d<<endl;
    return 0;
}


Measured memory_bytes: 3624
import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9+7

N,M = map(int,input().split())

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]
 
gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]
 
def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

def nPr(n,r):
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

ans = 0
for i in range(N+1):
  ans += pow(-1,i,MOD) * nCr(N,i) * nPr(M,i) * ( nPr(M-i,N-i) )**2
  ans %= MOD
print(ans)

Measured memory_bytes: 147448
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;

long long GCD(long long a, long long b) {
    if(b == 0)
        return a;
    else
        return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
    long long g = GCD(a, b);
    return a / g * b;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    long long K, N;
    cin >> K >> N;
    vector<long long> a(N);
    rep(i, 0, N) { cin >> a[i]; }
    long long min = a[N - 1] - a[0];
    rep(i, 1, N) {
        if(K - (a[i] - a[i - 1]) < min) {
            min = K - a[i] + a[i - 1];
        }
    }
    cout << min << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(void){
	int A,B;
    scanf("%d %d",&A,&B);
    if(A>B)
    printf("%d",A+A-1);
    else if(A<B)
    printf("%d",B+B-1);
    else
    printf("%d",A+B);
	return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline
N, M, K = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

csa = [0] * (N + 1)
csb = [0] * (M + 1)
for i in range(N): csa[i + 1] = csa[i] + a[i]
for i in range(M): csb[i + 1] = csb[i] + b[i]

def check(x):
  for i in range(N + 1):
    if i > x: break
    j = x - i
    if j > M: continue
    if csa[i] + csb[j] <= K: return True
  return False

ok = 0
ng = N + M + 1
while ng - ok > 1:
  m = (ok + ng) // 2
  if check(m): ok = m
  else: ng = m
print(ok)


Measured memory_bytes: 108924
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    string s, t;
    string ans="";
    int m=0;
    int n=-1;
    
    cin >> s;
    cin >> t;
    
    m = s.size() - t.size();
    
    if(m<0){
        
        cout << "UNRESTORABLE" << endl;
        
        return 0;
        
    }
    
    for(int i=0; i<=m; i++){
        
        for(int j=0; j<=t.size()-1; j++){
            
            if(s.at(i+j)!=t.at(j)&&s.at(i+j)!='?'){
                
                break;
                
            }
            
            if(j>=t.size()-1){
                
                n = max(n, i);
                
            }
            
        }
        
    }
    
    if(n>=0){
        
        for(int i=0; i<=s.size()-1; i++){
            
            if(i>=n&&i<=n+t.size()-1){
                
                cout << t.at(i-n);
                
            } else if(s.at(i)=='?'){
            
            cout << "a";
            
        } else {
            
            cout << s.at(i);
            
        }
            
        }
        
    } else {
        
        cout << "UNRESTORABLE";
        
    }
    
    cout << endl;
    
    return 0;
    
}

Measured memory_bytes: 256
N = int(input())
dic = {}
for i in range(N):
  a = int(input())
  if(a in dic):
    dic[a] += 1
  else:
    dic[a] = 1

ans = 0
for k, v in sorted(dic.items()):
  if(v%2 == 1):
    ans += 1
print(ans)

Measured memory_bytes: 19804
#include <bits/stdc++.h>
using namespace std;
 //int freq[10];
int main()
{
string s,t;
cin>>s>>t;
int s_num,t_num;
cin>>s_num>>t_num;
string u;
cin>>u;
if(u==s)
    s_num--;
else
    t_num--;
cout<<s_num<<" "<<t_num;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define chmax(p,q)(p=max(p,q))
#define bit(n,m)(((n)>>(m))&1)

ll n,k;
ll s[50];
ll dp[50][2];
int main(){
	scanf("%lld%lld",&n,&k);
	rep(i,0,n){
		ll t;
		scanf("%lld",&t);
		rep(j,0,50)if(bit(t,j))s[j]++;
	}
	rep(i,0,45)rep(f,0,2)rep(j,0,2)chmax(dp[i+1][j<bit(k,i)||(j==bit(k,i)&&f)],dp[i][f]+((j?n-s[i]:s[i])<<i));
	printf("%lld",dp[42][1]);
}

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

using namespace std;

int main() {
    string s, r;
    int count = 0;
    while (cin >> s) {
        r = s;
        reverse(r.begin(), r.end());
        if (s == r) count++;
    }
    cout << count << endl;
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i < b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	int n;
	cin >> n;

	vector<pair<pair<string, int>, int>> vp(n);
	rep(i, n) {
		cin >> vp[i].first.first >> vp[i].first.second;
		vp[i].first.second *= -1;
		vp[i].second = i + 1;
	}

	sort(vp.begin(), vp.end());

	rep(i, n) {
		out(vp[i].second);
	}

	return 0;
}

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

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

    int a,b;
    cin >> a >> b;

    int diff = abs(a-b);
    int evens = 0;
    if (a%2 == 0) evens++;
    if (b%2 == 0) evens++;

    if (evens == 0) cout << "Yes";
    else cout << "No";

    return 0;
}


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

int main(void)
{
    ios::sync_with_stdio(false);
    int ans=0, count=0;
    string s;
    cin>>s;
    for(int i=0; i<3; i++){
        if(s[i]=='R')
            count++;
        else{
            if(count>ans)
                ans = count;
            count=0;
        }
    }
    if(count&&count>ans)
        ans = count;
    cout<<ans;
    return 0;
}


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

int main() {
    int a, b; cin >> a >> b;
    int d = 1; while (d <= b) d *= 10;
    a = a * d + b;
    bool ok = false;
    rep(i, 1000) if (i * i == a) ok = true;
    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3648
def main():
    _ = int(input())
    A = [int(i) for i in input().split()]
    sumA = sum(abs(a) for a in A)
    minus_cnt = sum(1 if a < 0 else 0 for a in A)
    if minus_cnt % 2 == 0 or (0 in A):
        print(sumA)
    else:
        min_v = min(abs(a) for a in A)
        print(sumA - min_v*2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 64752
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  if(n==1){
    cout<<"Hello World"<<endl;
    return 0;
  }
  Int a,b;
  cin>>a>>b;
  cout<<a+b<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
struct edge {
	int to, cost;
};
int main() {
	int N, M, mod = 1000000007; long long X;
	cin >> N >> M >> X;
	vector<int> a(M), b(M), c(M), p(M);
	int all = 1;
	for (int i = 0; i < M; i++) cin >> a[i] >> b[i] >> c[i], p[i] = i, a[i]--, b[i]--;
	sort(p.begin(), p.end(), [&](int i, int j) { return c[i] < c[j]; });
	vector<vector<edge> > G(N);
	function<int(int, int, int)> dfs = [&](int pos, int pre, int tar) {
		if (pos == tar) return -(1 << 30);
		for (edge i : G[pos]) {
			if (i.to != pre) {
				int res = dfs(i.to, pos, tar);
				if (res != -1) return max(res, i.cost);
			}
		}
		return -1;
	};
	long long sum = 0;
	vector<long long> candy;
	for (int i = 0; i < M; i++) {
		int res = dfs(a[p[i]], -1, b[p[i]]);
		if (res == -1) {
			G[a[p[i]]].push_back(edge{ b[p[i]], c[p[i]] });
			G[b[p[i]]].push_back(edge{ a[p[i]], c[p[i]] });
			sum += c[p[i]];
			all = 2 * all % mod;
		}
		else candy.push_back(c[p[i]] - res);
	}
	int m1 = 1, m2 = 1, m3 = 1;
	for (long long i : candy) {
		long long val = i + sum;
		if (val >= X) m1 = 2 * m1 % mod;
		if (val > X) m2 = 2 * m2 % mod;
		m3 = 2 * m3 % mod;
	}
	int ret = 2LL * (m1 - m2 + mod) % mod;
	if (sum == X) ret = (ret + 1LL * (all + mod - 2) * m3) % mod;
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define INF -1

int size=0;

int parent(int i){
  return floor(i/2);
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

void maxHeapify(int *A,int i){
  int l,r,largest,ex;

  l=left(i);
  r=right(i);
  if(l<=size && A[l]>A[i])
    largest=l;
  else largest=i;
  
  if(r<=size && A[r]>A[largest])
    largest=r;
  if(largest!=i){
    ex=A[largest];
    A[largest]=A[i];
    A[i]=ex;
    maxHeapify(A,largest);
  }
}


int heapMaximum(int *A){
  return A[1];
}

int heapExtractMax(int *A){
  int max;
  if(size<1)
    printf("heap underflow\n");
  max=heapMaximum(A);
  A[1]=A[size];
  size--;
  maxHeapify(A,1);
  return max;
}

void heapIncreaseKey(int *A,int i,int key){
  int ex;
  if(key<A[i])
    printf("new key is smaller than current key\n");
  A[i]=key;
  while(i>1 && A[parent(i)]<A[i]){
    ex=A[i];
    A[i]=A[parent(i)];
    A[parent(i)]=ex;
    i=parent(i);
  }
}

void maxHeapInsert(int *A,int key){
  size++;
  A[size]=INF;
  heapIncreaseKey(A,size,key);
}

int main(){
  int *A,k;
  char com[20];
  A=malloc(sizeof(int*)*100000000);
  while(1){
    scanf("%s",com);
    if(com[0]=='i'){
      scanf("%d",&k);
      maxHeapInsert(A,k);
    }else if(com[0]=='e'){
      if(com[1]=='x'){
        printf("%d\n",heapExtractMax(A));
      }else break;
    }
  }
  return 0;
}



Measured memory_bytes: 5612
# -*- coding: utf-8 -*-
import heapq
import math
import sys

MOD = 1000000007

N, M = [int(a) for a in input().split()]
N += 1
a_s = []
for n in range(M):
    a = int(input())
    a_s.append(a)
    if a == N-1:
        print(0)
        exit()

a_set = set(a_s)

dp = [0 if i not in a_set else None for i in range(N)]
dp[0] = 1
for i in range(N):
    val = dp[i]
    if val is None:
        continue
    if i + 1 < N and dp[i+1] is not None:
        dp[i+1] += dp[i]
        dp[i+1] %= MOD
    if i + 2 < N and dp[i+2] is not None:
        dp[i+2] += dp[i]
        dp[i+2] %= MOD

print(dp[N-1])



Measured memory_bytes: 13332
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//https://www.creativ.xyz/dump-cpp-652/
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
 
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    int a,b; cin>>a>>b;
    if(a == b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

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

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const ll MOD  = (ll)1e9 + 7;
const ll INF  = (ll)1e9 + 1;
const ll LINF = (ll)1e18 + 1;

/**
 *  Binary indexed tree
 *  NOTE: 1-based indexing
 */
class BIT {
    using ll = long long;
public:
    std::vector<ll> bit;

    BIT(ll M) :
        bit(std::vector<ll>(M + 1, 0)) { }

    /**
     *  累積和を取得する
     *  @Return: i以下要素の和
     */
    ll getSum(ll i) {
        return !i ? 0 : bit[i] + getSum(i - (i & -i));
    }

    /**
     *  i番目の要素に値xを加える
     */
    void add(ll i, ll x) {
        if(bit.size() <= i) return;
        bit[i] += x;
        add(i + (i & -i), x);
    }
};

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

    ll N, K;
    std::cin >> N >> K;

    BIT bit(2000);
    vector<ll> A(N);
    ll ans = 0;
    REP(i, N) {
        std::cin >> A[i];
        bit.add(A[i], 1);
        ans += (i + 1 - bit.getSum(A[i])) * K;
        ans %= MOD;
    }

    REP(i, N) {
        ans += (N - bit.getSum(A[i])) * (((K - 1) * K / 2) % MOD);
        ans %= MOD;
    }

    std::cout << ans << std::endl;

    return 0;
}



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

int main() {
  int N;
  cin >> N;
  int a = 0;
  while(N > 0){
    if(N % 10 == 7){
      a = 1;
      break;
    }
    N = N /10;
  }
  if(a == 1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}
    

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a;
    cin>>a;
    double p=acos(-1.0);
    cout<<setprecision(10)<<2*a*p<<endl;
}

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

int main(){
  int n;
  while(1){
    cin >> n;
    if(n == 0) break;
    n++;
    int a[101];
    for(int i = 0;i < n;i++) cin >> a[i];

    bool flag = false;
    for(int i = 0;i < n;i++){
      int j = 0;
      bool flag = false;
      while(1){
        int tmp,tmp1,tmp2;
        tmp = i != j ? j : j+1;
        tmp1 = tmp+1 != i ? tmp + 1 : tmp + 2;
        tmp2 = tmp1+1 != i ? tmp1 + 1 : tmp1 + 2;
        if(a[tmp2] - a[tmp1] != a[tmp1]-a[tmp]){
          break;
        }
        if(i < n-1 && tmp2 == n-1 || i == n-1 && tmp2 == n-2 ){
          flag = true;
          break;
        }
        j++;
      }
      if(flag){
        cout << a[i] << endl;
        break;
      }
    }
  }

  return 0;
}





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

int main() {
  int X, Y,answer = 0, N, right, left, index = -1;
  cin >> X >> N;
  if(N == 0) cout << X << endl;
  else {
  vector <int> a(N);
  for(int i = 0; i < N; i++){
      cin >> a.at(i);
  }
    sort(a.begin(), a.end());

    for(int i = 0; i < N; i++){
        if(a.at(i) == X){
            index = i;
            break;
        }
    }

    for(int k = 0; k < N; k++){
        if(index - k >= 0){
            if(a.at(index - k) != X - k) {
                answer = X - k;
                
                break;
            }
        } else {
            answer = X - k;
            break;
        }
        if(index + k < N){
            if(a.at(index + k) != X + k) {
                answer = X + k;
                break;
            }
        } else {
            answer = X + k;
            break;
        }
    }

    cout << answer << endl;

  }
}

Measured memory_bytes: 3632
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    x, y = map(int, readline().split())
    ans = 0
    tmp = 1

    def modinv(a, mod=10 ** 9 + 7):
        return pow(a, mod - 2, mod)

    def com(n, r, mod):
        r = min(r, n - r)
        if r == 0:
            return 1
        res = ilist[n] * iinvlist[n - r] * iinvlist[r] % mod
        return res

    ilist = [0]
    iinvlist = [1]
    tmp = 1


    for i in range(1, x + y + 1):
        tmp *= i
        tmp %= mod
        ilist.append(tmp)
        iinvlist.append(modinv(tmp, mod))


    for b in range(x//2+1):
        a = x - 2 * b
        if 2*a + b == y:
            ans += ilist[a+b] * iinvlist[a] * iinvlist[b] % mod
    print(ans)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 222952
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] res = new int[n];

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

    for (int i = 1; i < n; i++) {
      int a = sc.nextInt();
      res[a - 1]++;
    }

    for (int i = 0; i < n; i++) {
      System.out.println(res[i]);
    }
  }
}


Measured memory_bytes: 60440
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>


#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s

typedef long long ll;

using namespace std;

ll modd = 998244353;

template<class T>
T fastpower(T a, long long n) {  // n must be >= 1
  if (n % 2 == 0) {  
      T halfpower = fastpower<T>(a, n/2);
      return (halfpower*halfpower % modd);
  } else {
      if (n == 1) {  return a; } else {  
          T halfpower = fastpower<T>(a, n/2);
          return ((halfpower*halfpower % modd)*a) % modd;
      }
  }
};


int main()   {
    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
    ll infinit = 10000000000000000;

//    readint(test_cases); 
    int test_cases = 1; 
    forr(t, 1, test_cases) {
        readint(n);
        readint(s);
        vector<ll> d;
        forr(i,0,n) {
            readint(kk); d.push_back(kk);
        }

        vector<pair<ll,ll>> poss(s+1, make_pair(0,0));
        poss[0] = make_pair(1,0);
        forr(i,0,n) {
            for (int j = poss.size()-d[i]-1; j >= 0; --j) {
                auto temp1 = poss[j+d[i]];
                auto temp2 = poss[j]; temp2.second++;
                int new_d = max(temp1.second, temp2.second);
                if (temp1.second < new_d) {
                    temp1.first *= fastpower<ll>(2,new_d - temp1.second); temp1.first = temp1.first % modd; temp1.second = new_d;
                }
                if (temp2.second < new_d) {
                    temp2.first *= fastpower<ll>(2,new_d - temp2.second); temp2.first = temp2.first % modd; temp2.second = new_d;
                }
                poss[j+d[i]] = make_pair((temp1.first + temp2.first) % modd, temp1.second);
            }
        }
        if (n>poss[s].second) {          
          ll ret = (fastpower<ll>(2,n-poss[s].second) * poss[s].first) % modd;
          cout << ret <<  endl;
        } else {
            cout << poss[s].first << endl;
        }
    }
    return 0;
}


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

using namespace std;

int main() {
   int a,b,c,d;
   cin >> a >> b >> c >> d;
   cout << max(min(b,d)-max(a,c),0) << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long int a, b, c;
    long long int ans = 0;

    cin >> a >> b >> c;

    if (b >= c) ans = b+c;
    else {
        ans = b*2;
        c -= b;

        if (a >= c) ans += c;
        else ans += a+1;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<functional>
#include<algorithm>
#include<bitset>
#include<utility>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a,b;
	cin>>a>>b;
	cout<<(a<b?0:10);
	return 0;
}


Measured memory_bytes: 256
n = int(input())
adj = []
# adj = [[None] * n for _ in range(n)]
ans = [[0] * n for _ in range(n)]

for i in range(n):
    temp = list(map(int, input().split()))
    if len(temp) > 2:
        adj.append(temp[2:])
    else:
        adj.append([])

# print(adj)
# print(ans)

for i in range(n):
    for j in range(len(adj[i])):
        ans[i][adj[i][j]-1] = 1

# print(ans)

for i in range(n):
    print(*ans[i])


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

using namespace std;

int main(){
  int N;
  cin >> N;
  map<int, int> m;
  for(int i = 0; i < N; i++){
    int A;
    cin >> A;
    m[A]++;
  }
  
  if(m.size() == N) puts("YES");
  else puts("NO");
  
  return 0;
}

Measured memory_bytes: 9600
/*
██╗  ██╗ █████╗ ██████╗ ███████╗███████╗███╗   ███╗        ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗ ████║        ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝ ███████║██████╔╝█████╗  █████╗  ██╔████╔██║        █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗ ██╔══██║██╔══██╗██╔══╝  ██╔══╝  ██║╚██╔╝██║        ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██║  ██║██║  ██║███████╗███████╗██║ ╚═╝ ██║███████╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
Believe in yourself ,( try and try and then try ), You can do it  
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define clr(arr, x) memset(arr, x, sizeof arr)
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define OO 0x3f3f3f3f3f3f3f3fLL
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
void K_K(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
int n;
vector<int>a, b, c;
int dp[100005][5];
int sol(int idx, int pre){
	if (idx == n)
		return 0;
	int &ret = dp[idx][pre];
	if (~ret)
		return ret;
	if (pre != 1)
		ret = max(sol(idx + 1, 1) + a[idx], ret);
	if (pre != 2)
		ret = max(sol(idx + 1, 2) + b[idx], ret);
	if (pre != 3)
		ret = max(sol(idx + 1, 3) + c[idx], ret);
	return ret;
}
int main(){
	K_K();
	cin >> n;
	a.resize(n);
	b.resize(n);
	c.resize(n);
	clr(dp, -1);
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i] >> c[i];
	cout << sol(0, 0);
}

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

const int N = 1e2 + 5;
const int V = 1e5 + 5;
const int INF = 1e9;

int w[N], v[N];
ll dp[N][V];
int n, wt;

ll solve(int i, int cv) {
  if (cv <= 0)
    return 0;
  if (i == n)
    return INF;
  if (dp[i][cv] != -1)
    return dp[i][cv];
  dp[i][cv] = min(solve(i+1, cv), w[i] + solve(i+1, cv - v[i]));
  return dp[i][cv];
}

int main () {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  for (int i = 0; i < N; i++)
    for (int j = 0; j < V; j++)
      dp[i][j] = -1;
  cin >> n >> wt;
  int mxv = 0;
  for (int i = 0; i < n; i++) {
    cin >> w[i] >> v[i];
    mxv += v[i];
  }
  int ans = -INF;
  for (int i = mxv; i >= 0; i--) {
    int can = solve(0, i);
    if (can <= wt) {
      ans = max(i, ans);
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 82304