akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long int
#define pb push_back

#define mod 1000000007
#define sp fixed<<setprecision(12)
using namespace std;
/*
const int MAX=10000005;
//vector<int> primes;
bitset<MAX> is_prime;
void sieve(){
    is_prime.set();
    is_prime[0]=is_prime[1]=0;
    for(int i=4;i<MAX;i+=2){
        is_prime[i]=0;
    }
    for(int i=3;i*i<MAX;i+=2){
        if(is_prime[i]){
            //primes.pb(i);
            for(int j=i*i;j<MAX;j+=i){
                is_prime[j]=0;
            }
        }
    }
}
*/
/*
void lcs(char s1[],char s2[]){
    int n=strlen(s1);
    int m=strlen(s2);
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            int sum=0;
            if(s1[i-1]==s2[j-1]){
                sum=1+dp[i-1][j-1];
            }
            else{
                sum=max(dp[i-1][j],dp[i][j-1]);
            }
            dp[i][j]=sum;
        }
    }
    
    int index=dp[n][m];
    //cout<<index<<endl;
    char ans[index+1];
    ans[index]='\0';
    index--;
    int x=n;
    int y=m;
    while(x>0 and y>0){
        if(dp[x-1][y]==dp[x][y-1] and dp[x-1][y]!=dp[x][y]){
            ans[index]=s1[x-1];
            index--;
            x--;
            y--;
        }else if(dp[x-1][y]>dp[x][y-1]){
            x--;
        }else{
            y--;
        }

    }
    //reverse(ans.begin(),ans.end());

    cout<<ans;
    return;
}
*/
int dp[101][100005];
int a[101];

void solve(){
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<=a[0];i++){
        dp[0][i]=1;
    }
    for(int i=1;i<n;i++){
        vector<int> pref(k+1);
        pref[0]=dp[i-1][0];
        for(int j=1;j<k+1;j++){
            pref[j]=(pref[j-1]+dp[i-1][j])%mod;
        }
        for(int j=0;j<k+1;j++){
            if(j>a[i]){
                dp[i][j]=(pref[j]-pref[j-a[i]-1]+mod)%mod;
            }else{
                dp[i][j]=pref[j];
            }
        }
    }
    cout<<dp[n-1][k]<<'\n';

}


int32_t main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    //double    pi=3.14159265358979323846;
    //sieve();
    int t=1;
    
    //cin>>t;

    for(int tc=1;tc<=t;tc++){
       solve();

    }
    
    return 0;
    
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int ctoi(char c) {
  return c - '0';
}

template <class C>
void printContainer(C &container, const char *delim=",") {
  for(const auto &e : container) {
    std::cout << e << delim;
  }
  std::cout << "\n";
}

// Greatest common divisor
template<class T>
T gcd(T x, T y) {
  if(x < y) {
    std::swap(x, y);
  }
  T r = x % y;
  while(r != 0) {
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

// Least common multiple
template<class T>
T lcm(T x, T y) {
  return (x*y)/gcd(x,y);
}

int main() {
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  int ans;
  if(n > k) {
    ans = x*k + (n-k)*y;
  }
  else {
    ans = n*x;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
long long int a,b,k;
cin >>a >>b >>k;
if (k%2==1){
for (int i=0;i<k/2;i++){
if(a%2==1){a-=1;
a/=2;
b+=a;}
else {a/=2;
b+=a;}
if(b%2==1){b-=1;
b/=2;
a+=b;}
else {b/=2;
a+=b;}
}
if(a%2==1){a-=1;
a/=2;
b+=a;}
else {a/=2;
b+=a;}}
else{
for (int i=0;i<k/2;i++){
if(a%2==1){a-=1;
a/=2;
b+=a;}
else {a/=2;
b+=a;}
if(b%2==1){b-=1;
b/=2;
a+=b;}
else {b/=2;
a+=b;}
}
}
cout <<a <<" "<<b <<endl;
}

Measured memory_bytes: 256
// Input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
    // テストコードをここにコピペする
r"1234567876
" => r"34",

r"35753
" => r"0",

r"1111111111
" => r"642"
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    let s: String;
    input! {
        source = src,
        s: String,
    }
    let ss = s.chars().collect::<Vec<char>>();
    let l = ss.len();
    let r = (0..l - 2)
        .map(|i| {
            (100 * ss[i].to_digit(10).unwrap() as i32)
                + (10 * ss[i + 1].to_digit(10).unwrap() as i32)
                + (ss[i + 2].to_digit(10).unwrap() as i32)
        })
        .map(|n| (n - 753).abs())
        .min()
        .unwrap();
    return r.to_string();
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
    #define ll  long long int
    #define pb push_back
    #define mp make_pair
    #define ff first
    #define ss second
    #define vi vector<int>
    #define br cout <<"\n";
    #define all(x)  (x).begin(),(x).end()
    #define tr(c,i) for(auto i : c)
    #define pii pair< int,int >
    #define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
    #define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
    #define er(x) cout << x << " "
    #define err(x,y) cout << x << " "<<y
    const int M = 200005;
    using namespace std;
    clock_t time_p=clock();
    void dem()
    {
        time_p=clock()-time_p;
        cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
    }
    using namespace std ;
    const int N =  100 ;
    const int dx[] = { 1, -1 , 0 , 0  };
    const int dy [] = { 0 ,0 , 1 , -1  };
    const int MOD = 1000 * 1000 * 1000 + 9 ;
    int main (){
   int n ;

   cin >> n ;
   int k ;
   if ( n & 1 ) k = n / 2  +  1;
   else
        k = n / 2 ;

   double res = (1.0 * k / n ) ;
      cout << fixed << setprecision(7) << res ;

    return 0 ;
    }


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

int main() {
	double answer=0;
	int N,W;
	cin >> N >> W;
	double w[N], v[N];
	for(int i=0; i<N; i++){
		cin >> w[i] >> v[i];
		if(w[i]<=0 && v[i]>=0){
			W-=w[i];
			answer+=v[i];
			w[i]=0;
			v[i]=0;
		}else if(w[i]>=0 && v[i]<=0){
			w[i]=0;
			v[i]=0;
		}
	}
	

	pair<double,double> plus[N], minus[N];	
	for(int i=0; i<N; i++){
		if(w[i]>0){
			plus[i].first=w[i]/v[i];
			plus[i].second=w[i];
			minus[i].first=0;
			minus[i].second=0;
		}else if(w[i]<0){
			minus[i].first=w[i]/v[i];
			minus[i].second=w[i];
			plus[i].first=0;
			plus[i].second=0;
		}
	}
	sort(plus,plus+N);
	sort(minus,minus+N);
	
	int p=0, m=N-1;	//plus, minus
	while(p<=N-1 && W-plus[p].second>=0){
		if(plus[p].first==0){
			p++;
			continue;
		}
		W-=plus[p].second;
		answer+=plus[p].second/plus[p].first;
		p++;
	}
	if(p==N){
		cout << fixed << setprecision(6) << answer << endl;
		return 0;
	}
	
	answer+=W/plus[p].first;
	plus[p].second-=W;
	W=0;
	if(plus[p].second==0){
		p++;
	}
	while(p<=N-1 && m>=0){
		if(minus[m].first<=plus[p].first){break;}
		
		if(-minus[m].second>plus[p].second){
			answer+=plus[p].second/plus[p].first;
			answer-=plus[p].second/minus[m].first;
			minus[m].second+=plus[p].second;
			p++;
		}else if(-minus[m].second<plus[p].second){
			answer-=minus[m].second/plus[p].first;
			answer+=minus[m].second/minus[m].first;
			plus[p].second+=minus[m].second;
			m--;
		}else if(-minus[m].second==plus[p].second){
			answer+=plus[p].second/plus[p].first;
			answer-=plus[p].second/minus[m].first;
			p++;
			m--;
		}

	}
	cout << fixed << setprecision(6) << answer << endl;
	return 0;
}


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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

signed main()
{
    double A,B,H,M;
    cin >> A >> B >> H >> M;
    double H_Degree, M_Degree, Degree, X_double = 0, X;
    H_Degree = 360 * ((H + (M / 60) ) / 12);
    M_Degree = M * 6;
    Degree = abs(H_Degree - M_Degree);
    X_double = pow(A, 2) + pow(B, 2) - 2 * A * B * cos(Degree * ( M_PI / 180));
    // cout << sqrt(X_double);
    // cout << X_double;
    printf("%.20f", sqrt(X_double));
}


Measured memory_bytes: 4216
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define int long long
using namespace std;
const int mod = 998244353, P = 200003, N = (1 << 19) + 100, G = 2, B = 4800;

ll n;
int a[N], qlg[N], rev[N], b[N];

inline void getRev(int lim) {
	static int lst = 0, n = 1;
	if (lst == lim) return;
	n = 1 << lim, lst = lim;
	for (R int i = 1; i < n; ++i)
		rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << lim >> 1);
	return;
}

inline int addMod(int a, int b) {
	return (a += b) >= mod ? a - mod : a;
}

inline ll quickpow(ll base, ll pw) {
	ll ret = 1;
	while (pw) {
		if (pw & 1) ret = ret * base % mod;
		base = base * base % mod, pw >>= 1;
	}
	return ret;
}

template <class T>
inline void read(T &x) {
	x = 0;
	char ch = getchar(), w = 0;
	while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
	while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	x = w ? -x : x;
	return;
}

void ntt(int *a, int lim, int inv) {
	getRev(lim);
	int n = 1 << lim;
	for (R int i = 0; i < n; ++i)
		if (i < rev[i]) swap(a[i], a[rev[i]]);
	for (R int l = 2; l <= n; l <<= 1) {
		int m = l >> 1, g = quickpow(3, (mod - 1) / l), d;
		if (inv) g = quickpow(g, mod - 2);
		for (R int i = 0; i < n; i += l)
			for (R int j = i, w = 1; j < i + m; ++j, w = (ll) w * g % mod)
				d = (ll) a[j + m] * w % mod, a[j + m] = addMod(a[j], mod - d), a[j] = addMod(a[j], d);
	}
	if (inv) {
		inv = quickpow(n, mod - 2);
		for (R int i = 0; i < n; ++i)
			a[i] = (ll) a[i] * inv % mod;
	}
	return;
}

signed main() {
	int pw = 2, x, lim = 0;
	for (R int i = 1; i < P - 1; ++i, pw = pw * G % P)
		qlg[pw] = i;
	read(n);
	ll ans = 0, m = 0;
	for (R int i = 1; i <= n; ++i) {
		read(x);
		if (x) ++a[qlg[x]], ++b[x];
		else ++m;
		ans -= (ll) x * x % P;
		while (1 << lim <= (qlg[x] + 10) << 1) ++lim;
	}
	n -= m;
	for (R int i = 1; i < P; ++i) {
		if (b[i] > B) {
			for (R int j = 1; j < P; ++j)
				ans += (ll) i * j % P * b[i] * b[j] * (1 + (i != j));
			n -= b[i], b[i] = a[qlg[i]] = 0;
		}
	}
	ntt(a, lim, 0);
	for (R int i = 0; i < 1 << lim; ++i)
		a[i] = (ll) a[i] * a[i] % mod;
	ntt(a, lim, 1), pw = 1;
	n = n * n;
	for (R int i = 0; i < 1 << lim; ++i)
		ans += (ll) a[i] * pw, pw = pw * G % P, n -= a[i];
	assert(!n);
	cout << ans / 2 << endl;
	return 0;
}

Measured memory_bytes: 14924
#include <bits/stdc++.h>
using namespace std;
bool arco(int p[4], int q[4]){
  for(int i=0; i<4; i++){
    if(p[i]!=q[i]){
      return false;
    }
  }
  return true;
}
int main(){
  int a,p[4]={},q[4]={1,1,2,2};
  int t;
  for(int i=0; i<6;i++){
    cin >> t;
    p[t-1]++;
  }
  for(int i=0; i<6; i++){
    if(arco(p,q)){
      cout << "YES" << endl;
      return 0;
    }
    next_permutation(q,q+4);
  }
  cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    while (true) {
        int h, w; cin >> h >> w;
        if (h == 0 && w == 0) break;
        for (int i = 0; i < w; i++) cout << '#'; cout << endl;
        for (int i = 2; i < h; i++) {
            cout << '#';
            for (int j = 2; j < w; j++) cout << '.';
            cout << '#' << endl;
        }
        for (int i = 0; i < w; i++) cout << '#'; cout << endl;
        cout << endl;
    }
}


Measured memory_bytes: 3048
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] a) {
        Scanner scan = new Scanner(System.in);
        String[] t = scan.nextLine().split("\\s");
        int n = Integer.valueOf(t[0]);
        int r = Integer.valueOf(t[1]);
        int c = n / r;
      	int p = 1;
        while (c != 0) {
          	c = c / r;
          	p++;
        }
        System.out.print(p);
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define INF = numeric_limits<long long>::max();
#define intf int_fast64_t
int main(){
    intf n,a;
    cin >>n >>a;
    if(n%500>a){
        cout << "No"<<endl;
    }else{
        cout << "Yes" <<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long inf = 1LL<<60;

long long dp[11][11];

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

    
    long long cnt=0;
    for(int i=1;i<=n;i++){
        int I = to_string(i).length()-1;
        int X = i/pow(10,I);
        int Y = i%10;

        /*if(Y==0){
            continue;
        }*/
        //int b = i - X*pow(10,I) + Y*pow(10,I) - Y + X;
        //if(b<=n){
            dp[X][Y] += 1;
        //}
    }
    long long ans=0;

    rep(i,10) rep(j,10) ans += dp[i][j]*dp[j][i];

    cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  
  int x;
  
  for(int i = 0;i < N;i++){
    int l,r;
    cin >> l >> r;
    
    x += r-l+1;
     
  }
  cout << x << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;

int main()
{
    int n, m;
    cin >> n >> m;
    int sol = 0;
    for (int i = 0; i < m; ++i)
    {
        int x;
        cin >> x;
        n -= x;
    }
    n = max(n, -1);
    cout << n;
}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader stdin = getStdin();
		String s = stdin.readLine();
		switch (s) {
		case "Sunny":
			System.out.println("Cloudy");
			break;
		case "Cloudy":
			System.out.println("Rainy");
			break;
		default:
			System.out.println("Sunny");
			break;
		}
	}
	
	public static BufferedReader getStdin() {
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		return stdin;
	}

}

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

int main(){
string S;
   cin>>S;
  
  int count=0, ans=0;
  for(int i=0; i<S.size(); i++){
   if(S[i]=='A'||S[i]=='C'||S[i]=='G'||S[i]=='T'){count++;}
   else{count=0;} 
   ans=max(ans, count);
  }
  
  cout<<ans;
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  ll n;cin>>n;
  vector<ll>num(n);
  ll rui[n+10]={};
  for(int i=0;i<n;i++){cin>>num[i];rui[i+1]=rui[i]+num[i];}
  vector<pair<ll,ll> >left(n+10);
  vector<pair<ll,ll> >right(n+10);
  ll lpo=1;
  for(int i=2;i<n-1;i++){
    while(i>lpo-1&&(((rui[i]-rui[lpo])-rui[lpo])>0))
      lpo++;
    if((lpo!=0)&&abs((rui[i]-rui[lpo])-rui[lpo])>abs((((rui[i]-rui[lpo-1])-rui[lpo-1])))){
      lpo--;
    }
    left[i-2]=mp(abs(rui[i]-rui[lpo]),rui[lpo]);
  }

  ll rpo=3;
  for(int i=2;i<n-1;i++){
    while(n>rpo-1&&((rui[n]-rui[rpo])-(rui[rpo]-rui[i]))>0)
      rpo++;
    if((rpo-i!=1)&&abs(((rui[n]-rui[rpo])-(rui[rpo]-rui[i])))>abs(((rui[n]-rui[rpo-1])-(rui[rpo-1]-rui[i])))){
	rpo--;
      }
      right[i-2]=mp(abs(rui[n]-rui[rpo]),abs(rui[rpo]-rui[i]));
      //cout<<right[i-2].F<<" "<<right[i-2].S<<endl;
  }
  //cout<<endl;
  ll ans=llINF;
  for(int i=0;i<n-3;i++){
    ll ma=max(max(left[i].F,left[i].S),max(right[i].F,right[i].S));
    ll mi=min(min(left[i].F,left[i].S),min(right[i].F,right[i].S));
    ans=min(ans,ma-mi);
    //cout<<ma-mi<<endl;
    //cout<<left[i].F<<" "<<left[i].S<<" "<<right[i].F<<" "<<right[i].S<<endl;
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
    int N, count = 1;
    string Slime;
    cin >> N >> Slime;
    for (int i = 1; i < N; i++) {
        if (Slime.at(i) == Slime.at(i - 1)) continue;
        else count++;
    }
    cout << count << endl;
}


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

#define FOR(i,a,n) for (int i = a; i < (int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define whole(f,x,...) ([&](decltype((x)) whole) { \
    return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
template<typename T> bool chmin(T &a, const T &b) {if (a > b) { a = b; return true; }return false;}
template<typename T> bool chmax(T &a, const T &b) {if (a < b) { a = b; return true; }return false;}

using ll = long long;

constexpr ll INF = (1e9);
constexpr ll MOD = (1e9+7);

ll gcd(ll a, ll b) {
  while (a) {
    b %= a;
    swap(a,b);
  }
  return b;
}

int main() {
  int n; ll k; cin >> n >> k;
  vector<ll> a(n); REP(i,n) cin >> a[i];
  whole(sort, a);
  a.erase(whole(unique,a), a.end());
  if (a.back() < k) {cout << "IMPOSSIBLE" << endl; return 0;}
  ll g = a[0]; for (auto aa : a) g = gcd(g, aa);
  if (k % g == 0) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  string S, T, U;
  int A, B;

  cin >> S >> T >> A >> B >> U;

  A -= S == U;
  B -= T == U;

  cout << A << " " << B << endl;
  return 0;
}


Measured memory_bytes: 256
one = []
two = []

a = input()
b = input()

for i in a:
  one.append(i)

for o in b:
  two.append(o)

count = 0

if one[0] == two[0]:
  count += 1
if one[1] == two[1]:
  count += 1
if one[2] == two[2]:
  count += 1
  
print(count)

Measured memory_bytes: 3064
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        sc.close();
        int[] mo = new int[s.length()];
        for(int i = 0 ; i < s.length() ; i++ ){
            mo[i] = (s.charAt(i) - 65 + n) % 26 + 65;
            System.out.print((char)mo[i]);
        }
        System.out.println();
    }
}

Measured memory_bytes: 39772
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s, n) for(int i = s; i < (int)(n); i++)
#define co(x) cout<<x<<endl
#define SQvec(i,j) vector<vector<int>> data(i, vector<int>(j))
#define mod 1000000000+7
typedef long long int lint;

int main() {
  int N;
  cin >> N;
  vector<lint> A(N);
  rep(i,0,N){cin >> A[i];}
  sort(A.begin(),A.end());
  co(A[N-1] - A[0]);
}

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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, N) for (int i=0; i<(int)N; i++)
#define rep1(i, N) for (int i=1; i<(int)N; i++)

using namespace std;

int n;

bool judge_same_array(int a[], int b[], int n){
  bool ret = true;
  rep(i, n) {
    if(a[i] != b[i]) {
      ret = false;
    }
  }
  return ret;
}

int main() {
  cin >> n;
  int p[n], q[n];
  rep(i, n) cin >> p[i];
  rep(i, n) cin >> q[i];  
  int arr[n];
  rep(i, n) arr[i] = i+1;
  int a = 0;
  int b = 0;
  
  int i = 0;
  do {
    if(judge_same_array(arr,p,n)) a = i;
    if(judge_same_array(arr,q,n)) b = i;
    i++;
  } while(next_permutation(arr, arr+n));
  
  cout << abs(b-a) << endl;
}


Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k == X:
                ans += 1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
const int INFTY =2147483647;
int main(){
    int x,ans=0;
    cin>>x;
    ans+=1000*(x/500);
    x%=500;
    ans+=5*(x/5);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,s;
int main()
{
	cin>>n;
	s=1;
	for(int i=1;i<=10;i++)
	{
		s*=2;
		if(s>n)
		{
			cout<<s/2<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int n,m,q,v[12],a[55],b[55],c[55];
ll ans=-INFLL,d[55];

void solve(int i, int x){
	int j;
	ll tmp = 0ll;
	if(i<n){
		for(j=x; j<=m; ++j){
			v[i] = j;
			solve(i+1,j);
		}
	}else{
		for(j=0; j<q; ++j){
			if(v[b[j]]-v[a[j]]==c[j]){
				tmp += d[j];
			}
		}
		ans = std::max(ans,tmp);
	}
}

int main(void){
	int i;
	std::cin >> n >> m >> q;
	for(i=0; i<q; ++i){
		std::cin >> a[i] >> b[i] >> c[i] >> d[i];
		--a[i]; --b[i];
	}
	solve(0,1);
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = new int[N];
            var B = new int[N];
            for (int i = 0; i < N; i++)
            {
                var ss = Console.ReadLine().Split();
                A[i] = int.Parse(ss[0]);
                B[i] = int.Parse(ss[1]);
            }

            var AB = A.Zip(B, (a, b) => new { a, b })
                .OrderBy(p => p.b)
                .ToArray();

            var time = 0;
            for (int i = 0; i < N; i++)
            {
                time += AB[i].a;
                if (time > AB[i].b)
                {
                    Console.WriteLine("No");
                    return;
                }
            }
            Console.WriteLine("Yes");
        }
    }
}

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

int main(){
  int count=0;
  long N;
  string S;
  cin>>N>>S;
  rep(i,N-1){
    if(S[i]!=S[i+1]){
      count++;
    }
  }
  cout<<count+1;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(0);
	ll n,s,e,a,b;
	cin>>n>>s>>e>>a>>b;
	ll p1,q1,p2,q2;
	p1 = -(n - 1)*b + s;
	p2 = -(n - 1)*a + s;
	while(true)
	{
		// cout<<p1<<" "<<p2<<endl;
		if(e >= p1 && e <= p2){
			cout<<"YES\n"; return 0;
		}
		p1 = p1 + b + a;
		p2 = p2 + a + b;
		if(p1 > s + (n - 1)*a)
			break;
	}
	cout<<"NO\n";

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
//const long long mod = 1000000007;
//const long long mod = 998244353;

int main() {
	char s[4], t[4];
	scanf("%s", s);
	scanf("%s", t);
	int res = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i])res++;
	}
	printf("%d", res);
	return 0;
}

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

int main() {
    int fact[9] = { 1, 1, 2, 6, 24, 120, 720, 5040, 40320 };
    int order[9];

    int n; cin >> n;
    int porder = 0, qorder = 0;

    for (int i = 0; i <= n; ++i) order[i] = i;
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        porder += fact[n - i - 1] * (order[a] - 1);
        for (int j = a + 1; j <= n; ++j) --order[j];
    }
    ++porder;

    for (int i = 0; i <= n; ++i) order[i] = i;
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        qorder += fact[n - i - 1] * (order[a] - 1);
        for (int j = a + 1; j <= n; ++j) --order[j];
    }
    ++qorder;

    cout << abs(porder - qorder) << endl;
}



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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  vector<int>a(5);
  rep(i, 5)cin>>a[i];
  rep(i, 5)if(a[i]==0){cout<<i+1<<endl; return 0; }

  return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f3f3f3f3f
#define pi 3.1415926535898
#define N 200050
using namespace std;
int n,m,k;
int f[N],cnt[N],ans[N],fn[N],tot[N];
int fin(int x)
{
    if(f[x]==x)
    {
        return x;
    }
    else
    {
        return f[x]=fin(f[x]);
    }
}
void uinty(int x,int y)
{
    int f1=fin(x),f2=fin(y);
    if(f1!=f2)
    {
        f[f2]=f1;
    }
}
int main()
{

    cin>>n>>m>>k;
    for(int i=1; i<=n; i++)
    {
        f[i]=i;
    }
    for(int i=1; i<=m; i++)
    {
        int a,b;
        cin>>a>>b;
        cnt[a]++;
        cnt[b]++;
        uinty(a,b);
    }
    for(int i=1; i<=n; i++)
    {
        f[i]=fin(i);
    }
    for(int i=1; i<=n; i++)
    {
        fn[f[i]]++;
    }
    for(int i=1; i<=k; i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        if(f[a]==f[b])
        {
            tot[a]++,tot[b]++;
        }

    }
    for(int i=1; i<=n; i++)
        ans[i]=fn[f[i]]-cnt[i]-tot[i]-1;
    for(int i=1; i<n; i++)
        printf("%d ",ans[i]);
    printf("%d\n",ans[n]);

    return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;

  vector<int> x(m);
  for (int i = 0; i < m; i++) cin >> x[i];
  sort(x.begin(), x.end());

  multiset<int> space;
  for (int i = 0; i < m - 1; i++) {
    int s = x[i + 1] - x[i] - 1;
    if (s > 0) space.insert(s);
  }

  int ans = x[m - 1] - x[0] + 1 - n;
  if (space.size() == 0) {
    cout << max(0, ans) << endl;
    return 0;
  }

  auto itr = space.rbegin();
  for (int i = 0; i < n - 1 && itr != space.rend(); i++) {
    ans -= *itr;
    itr++;
  }
  ans = max(0, ans);
  cout << ans << endl;
}


Measured memory_bytes: 5892
#include <bits/stdc++.h>
#define lli long long int
#define inf 2147483647
#define infll LLONG_MAX
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    int n, m;
    cin >> n >> m;
    double limit = 0;
    vector<int> a(n);
    rep(i, n){
        cin >> a[i];
        limit += a[i];
    }

    limit = limit / (4 * m);
    sort(a.begin(), a.end(), greater<int>());

    if(a[m-1] >= limit) Yes();
    else No(); 
}

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

int main(){
  string str, cmnd, p;
  int q, a, b;

  cin >> str >> q;

  for(int i = 0; i < q; i++){
    cin >> cmnd >> a >> b;
    
    if(cmnd == "print"){
      cout << str.substr(a, b-a+1) << endl;
    } else if(cmnd == "reverse"){
      string keep = str.substr(a, b-a+1);         //??\???????????????????????????
      int n = keep.size();                        //??\??????????????????????????????
      for(int j = 0; j < n; j++) str[a+j] = keep[n-j-1]; //??\?????????
    } else if(cmnd == "replace"){
      cin >> p;
      str = str.replace(a, b-a+1, p);
    }
  }

  return 0;
}

Measured memory_bytes: 1220
#include<iostream>
#include<queue>
#include<map>
#define LEN 100
#define BASE 25

using namespace std;

int maps[LEN][LEN];
int off[LEN][LEN];

int checker[4];
int ncheck[4];

map<int, int> points[LEN];

class State {
public:
	char where;
	int enemy;
	int budget;
	int check[4];
	State() {}
	State(char w, int e, int b ) {
		where = w;
		enemy = e;
		budget = b; 
		check[0] = ncheck[0];
		check[1] = ncheck[1];
		check[2] = ncheck[2];
		check[3] = ncheck[3];
	}
};


inline bool operator< ( const State& a, const State& b) {
	if( a.enemy == b.enemy )
		return a.budget > b.budget;
	return a.enemy < b.enemy;
}

inline bool operator> ( const State& a, const State& b) {
	if ( a.enemy == b.enemy )
		return a.budget < b.budget;
	return a.enemy > b.enemy;
}

priority_queue<State, vector<State>, greater<State> > status;

inline void copy ( State now ) {
	checker[0] = now.check[0];
	checker[1] = now.check[1];
	checker[2] = now.check[2];
	checker[3] = now.check[3];
}

inline void ncopy ( ) {
	ncheck[0] = checker[0];
	ncheck[1] = checker[1];
	ncheck[2] = checker[2];
	ncheck[3] = checker[3];
}

inline bool check ( int i ) {
	return 0 == ((1<<(i%25)) & checker[i/BASE]);
}

inline void add ( int i ) {
	ncheck[i/BASE] = ((1<<(i%25)) | checker[i/BASE]);
}

inline void insert ( int i, int e, int b ) {
	
	map<int,int>::iterator itr = points[i].find(e);
	if ( itr == points[i].end() ) {
		points[i][e] = b;
		status.push(State(i,e,b));
	} else if ( (*itr).second < b ) {
		(*itr).second = b;
		status.push(State(i,e,b));
		int min = b;
		while ( itr != points[i].end() ) {
			if ( (*itr).second > min ) {
				min = (*itr).second;
			} else {
				(*itr).second = min;
			}
			itr++;
		}
	}
}

int main () {


	while ( true ) {
		int n,m,l;
		cin >> n >> m >> l;

		if ( n == 0 )
			break;

		for ( int i=0; i<n; i++ ) {
			for ( int j=0; j<n; j++ ) {
				maps[i][j] = -1;
				off[i][j] = 0;
			}
			points[i].clear();
		}

		for ( int i=0; i<m; i++ ) {
			int a,b,d,e;
			cin >> a >> b >> d >> e;

			maps[a-1][b-1] = maps[b-1][a-1] = d;
			off[a-1][b-1] = off[b-1][a-1] = e;
		}
		
		for ( int i=0; i<4; i++ ) {
			ncheck[i] = 0;
			checker[i] = 0;
		}

		priority_queue<State, vector<State>, greater<State> > empty;
		status = empty;

		ncheck[0] = 1;
		status.push(State(0,0,l));
		
		while(!status.empty()) {
			State now = status.top();
			status.pop();
			if ( now.where == n-1 ) {
				cout << now.enemy << endl;
				break;
			}

			copy(now);

			for ( int i=0; i<n; i++ ) {
				if ( maps[now.where][i] > 0 ) {

					if ( check( i ) ) {
						ncopy();
						add(i);
						
						int e, b;
						if ( off[now.where][i] == 0 ) {
							e = now.enemy;
							b = now.budget;
							insert(i,e,b);
						} else {
							if ( now.budget - maps[now.where][i] >= 0 ) {
								e = now.enemy;
								b = now.budget - maps[now.where][i];
								insert(i,e,b);
							}
							e = now.enemy + off[now.where][i];
							b = now.budget;
							insert(i,e,b);
						}
					}
				}
			}
		}
	}
}

		

Measured memory_bytes: 2052
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String[] line;
      MyList list = new MyList();

      for(int i=0; i<n; i++) {
        line = br.readLine().split(" ");
        switch( line[0] ) {
          case "insert" :
            list.insertFirst( Integer.parseInt(line[1]) );
            break;
          case "delete" :
            list.delete( Integer.parseInt(line[1]) );
            break;
          case "deleteFirst" :
            list.deleteFirst();
            break;
          case "deleteLast" :
            list.deleteLast();
            break;
          default :
            System.out.println("n:" + i + " is failed.");
        }
      }

      System.out.println ( list.getAllElements() );
    }
  }
}

class Node {
  Node next,prev;
  int key;

  public Node(int key) {
    this.key = key;
  }
}

class MyList {
  Node nil;
  Node current;
  int size;

  public MyList() {
    nil = new Node(0);
    nil.next = nil.prev = nil;
    size = 0;
  }

  public String getAllElements() {
    StringBuilder buf = new StringBuilder(size*2);

    if(size > 0){
      current = nil.next;
      for(int i=0; i<size; i++){
        buf.append(current.key).append(" ");
        current = current.next;
      }
    }
    buf.setLength(buf.length()-1);

    return buf.toString();
  }
  public void insertFirst(int x) {
    if(size == 0) {
      current = new Node(x);
      nil.next = current;
      nil.prev = current;
      current.prev = nil;
      current.next = nil;
      size++;
    }
    else {
      Node add = new Node(x);
      
      current.prev.next = add;
      add.prev = current.prev;

      add.next = current;
      current.prev = add;

      current = add;
      size++;
    }
  }
  public void deleteFirst() {
    nil.next = current.next;
    current.next.prev = current.prev;

    current = current.next;
    size--;
  }
  public void deleteLast() {
    current = nil.prev;

    nil.prev = current.prev;
    current.prev.next = current.next;

    current = nil.next;
    size--;
  }
  public void delete(int x) {
    Node target = findFirst(x);

    if(target == nil) current = current.next;
    else {
      current.prev.next = target.next;
      current.next.prev = target.prev;
      current = nil.next;
      size--;
    }
  }
  private Node findFirst(int x) {
    while(current != nil) {
      if(current.key == x) break;
      current = current.next;
    }

    return current;
  }
}


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

using namespace std;

#define ll long long
#define ini(arr, val) memset(arr, (val), sizeof(arr))
#define loop(i,n)  for(ll i=0; i<n; i++)
#define loop1(i,n)  for(ll i=1; i<=n; i++)

#define all(a)      (a).begin(),(a).end()
#define exist(s,e)  (s.find(e)!=s.end())
#define dbg(x)  cout << #x << " = " << x << endl
#define pt(x) cout<<x<<"\n"
#define pts(x) cout<<x<<" "

#define mp make_pair
#define pb push_back
#define F first
#define S second


#define inf (int)1e9
#define infll 1e18
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007


#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test   int t; cin>>t; while(t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef set<int> si;

typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pll> vpll;
typedef vector<vl> vvl;
typedef map<ll,ll> mll;
typedef set<ll> sl;


int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };



//===========================DEBUG======================//
#define XOX 1
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

//================================================================//



//////////////////////////////////////////////////////////////////////////////////////////
//                      main starts
//////////////////////////////////////////////////////////////////////////////////////////
int const lmt=2e5+5;
ll n,m,k;
ll a[lmt], b[lmt];

ll bs(ll kk){

	ll lo=0, hi=m-1,mid;
	while(lo<=hi){
		mid = lo + (hi-lo)/2;
		if(b[mid]<=kk)lo = mid+1;
		else hi=mid-1;
	}
	return hi;
}

int main(){
    #ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
    fast

    cin>>n>>m>>k;
    loop(i,n) cin>>a[i];
    loop(i,m) cin>>b[i];
    ll sum=0;
    loop(i,m){
    	sum += b[i];
    	b[i]=sum;
    }

    sum=0;
    ll ans = 1+bs(k);
    loop(i,n){
    	sum+=a[i];
    	if(sum>k)break;
    	ans = max(ans,i+2+bs(k-sum));
    }	
    pt(ans);
}


/*


*/





Measured memory_bytes: 6748
#include <bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i = (a);i <= (b);++i)
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 1e9+7;
ll qpow(ll a,ll b){ll res = 1;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int pre[maxn];
int Find(int x)
{
	return pre[x]==x?x:pre[x]=Find(pre[x]);
}
int cnt[maxn];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i = 1;i <= n;++i){
		cnt[i] = 1;
		pre[i] = i;
	}
	int ans = 1;
	for(int i = 1;i <= m;++i){
		int x,y;
		scanf("%d%d",&x,&y);
		x = Find(x);
		y = Find(y);
		if(x!=y){
			pre[x] = y;
			cnt[y] += cnt[x];
			ans = max(ans,cnt[y]);
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 5320
#include <stdio.h>
#include <stdlib.h>
#define E 1000000000000000000
int main()
{
    long int a,b;
    long long int c;
    while(scanf("%ld%ld",&a,&b)!=EOF)
    {
        int i;
        if(a%b==0)
            printf("-1\n");
        else
            for(i=2;;i++)
            {
                c=i*a;
                if(c>E)
                {
                    printf("-1\n");
                    break;
                }
                if(c%b)
                {
                    printf("%lld\n",c);
                    break;
                }
            }
    }
    return 0;
}


Measured memory_bytes: 128
import Foundation
// 第一引数に二分探索したい配列を渡す
// 第二引数に検索したい要素を渡す
func binarySearch(list:[Int],item:Int,cnt:Int)->Int{
    // 解の存在範囲を初期化
    var low = -1
    var high = cnt
    // 解の存在範囲が1より大きい間、繰り返す
    while (high - low > 1) {
        let mid = Int(floor(Double(low + high) / 2))
        if list[mid] >= item {
            // midが条件を満たせば、解の存在範囲は(low,mid]
            high = mid
        } else {
            // midが条件を満たさなければ、解の存在範囲は(mid,high]
            low = mid
        }
    }
    // この時点で、low + 1 = highとなっている
    return high
}

// 標準入力の受け取り
let n = Int(readLine()!)!
var a = readLine()!.split(separator:" ").map{Int($0)!}
var b = readLine()!.split(separator:" ").map{Int($0)!}
var c = readLine()!.split(separator:" ").map{Int($0)!}

// とりあえず各配列をソートする
a.sort { $0 < $1 }
b.sort { $0 < $1 }
c.sort { $0 < $1 }

// 答えを入れる変数を用意
var ans = 0;

// 中部のパーツの配列に対して全探索
for i in b{
    // 各配列に対して二分探索
    let ai = binarySearch(list:a,item:i,cnt:n)
    let ci = binarySearch(list:c,item:i+1,cnt:n)
    
    // ansに考えられるパーツの組み合わせの個数を加える
    ans += (ai)*(n-ci)
}

// 答えを出力
print(ans)


Measured memory_bytes: 22948
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = acos(-1) ;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw				"\n"


int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans=0;
	db c,d;
	cin>>c;
	d=c*1.0/1.08;
	
	m=(int)d*1.08;
	n=(int)(d+1)*1.08;
	if(m==(int)c)
		cout<<(int)d;
	else if(n==(int)c)
		cout<<(int)(d+1);
	else cout<<":(";

}


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

struct Panel{
	string name;
	int x1,y1,x2,y2;
	bool operator<(const Panel &p)const{return x1<p.x1;}
	void print(){
		cout<<name<<':'<<x1<<','<<y1<<','<<x2<<','<<y2<<endl;
	}
};


vector<Panel> v;

void extract(string &s){
	for(int i=0;i+1<s.size();i++){
		if(s[i]=='<'&&s[i+1]!='/'){
			char c;
			Panel panel;
			string tmp;
			for(i++;s[i]!='>';i++)tmp+=s[i];
			panel.name=tmp;
			tmp.clear();
			for(i++;s[i]!=',';i++)tmp+=s[i];
			panel.x1=atoi(tmp.c_str());
			tmp.clear();
			for(i++;s[i]!=',';i++)tmp+=s[i];
			panel.y1=atoi(tmp.c_str());
			tmp.clear();
			for(i++;s[i]!=',';i++)tmp+=s[i];
			panel.x2=atoi(tmp.c_str());
			tmp.clear();
			for(i++;s[i]!='<';i++)tmp+=s[i];
			panel.y2=atoi(tmp.c_str());
			i--;
			v.push_back(panel);
		}
	}
}


int main(){
	int n;
	char c;
	while(cin>>n&&n){
		string s;
		cin>>s;
		v.clear();
		extract(s);
		sort(v.begin(),v.end());
		//for(int i=0;i<v.size();i++)v[i].print();
		for(int i=0;i<n;i++){
			int x,y;
			cin>>x>>y;
			int a=-1;
			for(int j=v.size()-1;j>=0;j--){
				if(v[j].x1<=x&&v[j].y1<=y&&x<=v[j].x2&&y<=v[j].y2){
					a=j;
					break;
				}	
			}
			if(a==-1){
				cout<<"OUT OF MAIN PANEL 1"<<endl;
				continue;
			}
			vector<int> child;
			for(int j=a+1;j<v.size();j++){
				if(v[a].x1<=v[j].x1&&v[a].y1<=v[j].y1&&v[j].x2<=v[a].x2&&v[j].y2<=v[a].y2){
					bool f=true;
					for(int k=0;k<child.size();k++){
						Panel &p=v[child[k]];
						if(p.x1<=v[j].x1&&p.y1<=v[j].y1&&v[j].x2<=p.x2&&v[j].y2<=p.y2){
							f=false;
						}
					}
					if(f)child.push_back(j);
				}
			}
			cout<<v[a].name<<' '<<child.size()<<endl;
		}
	}
    return 0;
}

Measured memory_bytes: 1248
program ABC_087_B_Coins
   implicit none
   integer A, B, C, X, count50, count100, count500, i, j, k, co
   read(*, *) A
   read(*, *) B
   read(*, *) C
   read(*, *) X
   co = 0   
   X = X / 50
   do k = 0, A
      do j = 0, B
	      do i = 0, C
              if( 10*k + 2*j + 1*i == X ) then
			      co = co + 1
			  end if
		  end do
	  end do
   end do
   write(*, *) co
   
   
end program ABC_087_B_Coins

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main() {
    int N, K; cin >> N >> K;
    vector<long long int>height(N);
    long long int max_height=0, answer=INT64_MAX, cost=0;
    int num = 1;
    for (int i = 0; i < N; i++)cin >> height.at(i);
    for (int bit = 0; bit < (1 << N); bit++) {
        max_height = height.at(0), cost = 0,num=1;
        for (int i = 1; i < N; i++) {
            if (bit & (1 << i)) {
                num++;
                if (max_height >= height.at(i)) {
                    cost += max_height - height.at(i) + 1;
                    max_height++;
                }
            }

            if (max_height < height.at(i))max_height = height.at(i);
        }
        if (num >= K && cost <= answer)answer = cost;
    }
    cout << answer << endl;
     return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stack>
#include <cmath>
#include <string>
#define  endl "\n"
using namespace std;

void FastInput() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
void OutputFile()
{
    freopen("output.txt","w",stdout);
}

string a[1000000];

int main()
{

    FastInput();
    int n,r=1;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    int c=1;
    for(int i=0;i<n-1;i++)
    {
        if(a[i]==a[i+1])
            continue;
            c++;

    }
    cout<<c<<endl;


    return 0;
}


Measured memory_bytes: 34900
import java.util.*;

public class Main{
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args){
		int n = sc.nextInt();
		int k = sc.nextInt();
		int ans = 0;
		for(int i = 0; i < n; ++i){
			int h = sc.nextInt();
			if(h >= k) ++ans;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 46264