akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[2][n];
  for(int i=0;i<2;++i){
    for(int j=0;j<n;++j){
      cin >> a[i][j];
    }
  }
  int dp[2][n];
  memset(dp, 0, sizeof dp);
  dp[0][0]=a[0][0];
  dp[1][0]=a[1][0] + a[0][0];
  for(int i=1;i<n;++i){
    dp[0][i] = dp[0][i-1] + a[0][i];
  }
  for(int i=1;i<n;++i){
    dp[1][i] = a[1][i] + max(dp[0][i], dp[1][i-1]);
  }
  cout << dp[1][n-1];
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();

        String[] input = line.split(" ", 0);

        int N = Integer.valueOf(input[0]).intValue();
        int K = Integer.valueOf(input[1]).intValue();
        int[] bunbo = new int[N];
        double result = 0.0;

        for(int i = 1; i < N+1; i++){
            int j = i;
            bunbo[i-1] = N;
            while(K > j) {
                j *= 2;
                bunbo[i-1] *= 2;
            }
            result += 1.0/bunbo[i-1];
        }

        System.out.println(result);

    }
}

Measured memory_bytes: 21844
/*input
TUE
*/
#include<bits/stdc++.h>
#define int long long
#define MOD 1000000007
#define MAX 100005
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define mii map<int,int>
#define vi vector<int>
#define ff first
#define ss second
#define T int t;cin>>t;while(t--)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define umi unordered_map<int,int>
#define maxheap priority_queue<int>
#define minheap priority_queue<int,vector<int>,greater<int> >
#define inp(n) for(int i=0;i<n;i++)
#define N 2000005
 
using namespace std;
using namespace std::chrono;
 
 
signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
string s;
cin >> s;
string in[7]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
int i=0;
while(i<7){
	if(s == in[i])	break;	i++;
}
 
int ans = 6-i;
if(ans == 0)	ans = 7;
cout << ans << '\n';
 
}

Measured memory_bytes: 256
fn main(){
    let n:i32 = getline().trim().parse().unwrap();
    let mut aa:Vec<i32> = getline().trim().split(' ').map(|e| e.parse().unwrap()).collect();
    aa.sort();
    println!("{}", aa[n as usize - 1] - aa[0]);
}

fn getline() -> String{
    let mut r = String::new();
    std::io::stdin().read_line(&mut r).ok();
    return r;
}


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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define pb push_back
#define INF 1000000000000000000
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

int main()
{
    FAST_IO;

    int a, b;
    cin >> a >> b;
    if (a < 6) cout << 0;
    else if (a < 13) cout << b/2;
    else cout << b;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define sqr(x) (x) * (x)
#define cube(x) (z) * (z) * (x)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define itn int

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

template <class T = int>
int in() {
  T x;
  cin >> x;
  return x;
}

signed main() {
  int N, K;
  const int num = 100000;
  cin >> N >> K;
  vector<int> nums(num, 0);
  rep(i, N) {
    int temp_a, temp_b;
    cin >> temp_a >> temp_b;
    nums[temp_a - 1] += temp_b;
  }
  int now = 0;
  rep(i, num) {
    if (now + nums[i] >= K) {
      cout << i + 1 << endl;
      return 0;
    }
    now += nums[i];
  }
}


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

int Caluculater(int a, int b, char op);

int main(){
    int a,b;
    int result[10000],i=0,j=0;
    char op;
    
    while(1){
    cin >> a >> op >> b;
    if(op == '?') break;
    result[i] = Caluculater(a,b,op);
    i++;
    j++;
    }
    for(i = 0; i < j; i++){
        cout << result[i] << endl;
    }
    return 0;
}

int Caluculater(int a, int b, char op){
    if(op == '+') return a + b;
    else if(op == '-') return a - b;
    else if(op == '*') return a * b;
    else if(op == '/') return a / b;
}


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


int main() {
    ll N;
    cin >> N;
    ll sum = 0;
    erep1(i, N) {
        if (i % 3 == 0) continue;
        if (i % 5 == 0) continue;
        sum += i;
    }
    cout << sum << endl;
}

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

int main(){
    int m,f,r;
    int i;
    for(i=1;i>0;i++){
        cin >> m >> f >> r;
        
        if((m==-1)and(f==-1)and(r==-1)){
            break;
        }
        else if((m== -1) or (f == -1)){
            cout << "F" << endl;
        }
        else{
                int total ;
            total = m + f;
            if(total >= 80){
                cout << "A" << endl;
            
            }
            else if(total >=65){
                cout << "B" << endl;
            }
            else if (total >= 50){
                cout << "C" << endl;
            }
            else if (total >= 30){
                if(r >= 50){
                    cout << "C" << endl;
                }
                else {
                    cout << "D" << endl;
                }
            }
            else {
                cout << "F" << endl;
            }
        }
        
    }
}


Measured memory_bytes: 3104
x, y, a, b, c = list(map(int, input().split()))

pA = list(map(lambda x: (int(x), "a"), input().split()))
pB = list(map(lambda x: (int(x), "b"), input().split()))
pC = list(map(lambda x: (int(x), "c"), input().split()))

apples = sorted(pA + pB + pC)

cntA = 0
cntB = 0
cntC = 0
cnt = 0

while cntA + cntB + cntC < x+y:
    val, col = apples.pop()

    if col == "a" and cntA < x:
        cntA += 1
        cnt += val
    elif col == "b" and cntB < y:
        cntB += 1
        cnt += val
    elif col == "c":
        cntC += 1
        cnt += val

print(cnt)

Measured memory_bytes: 48120
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;

int main()
{
    int m,n;
    cin>>n>>m;
    cout<<(1900*m+100*(n-m))*pow(2,m)<<endl;
    return 0;
}


Measured memory_bytes: 4188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int num[]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int n;
	cin>>n;
	cout<<num[n]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}
int main(void){
    int i, N[4];
    for (i = 0; i < 4; i++) scanf("%d%*c", &N[i]);
    qsort(N, 4, sizeof(int), cmp);
    if (N[0] == 1 && N[1] == 4 && N[2] == 7 && N[3] == 9) printf("YES\n");
    else printf("NO\n");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
main()
{
	int n,k;
	cin>>n>>k;
	vector<long long>X(n);
	long long S=0;
	for(int i=0;i<n;i++)
	{
		cin>>X[i];
		S=S+X[i];
	}
	long long s=0;
sort(X.rbegin(),X.rend());
for(int i=0;i<min(n,k);i++)
{
	s=s+X[i];
}

cout<<S-s;	
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (xe).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;
typedef pair<long long, long long> pll;
// scanf("%d %d %d %d", &w, &b, &d, &s); %lld
// printf("%d\n", points);
// const double PI = acos(-1);

int main() 
{
	fastIO;
	float n, x, t;
	int ans;
	cin >> n >> x >> t;
	ans = ceil(n/x)*t;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inp(n) for(i=0;i<n;i++) cin>>A[i];
#define inz(A) memset(A,0,sizeof(A))
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define T 1000000
#define F first
#define S second
#define pi pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define vp vector<pair< int,int> >
#define mip map<int, pair<int,int> >
#define inf INT_MAX
#define sz(v) v.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define debug(a,n) for(i=0;i<n;i++)cout<<a[i]<<" ";
#define d(x) cout<<x<<endl;
#define lower(s) transform(all(s),s.begin(),::tolower)
vector<int>adj [T];
			/*brownsands IIITA*/

void solve()
{  int n,i,A[100001],dp[100001];
    cin>>n;
    for(i=0;i<n;i++)
    cin>>A[i];
    dp[n-1]=0;
    for(i=n-2;i>=0;i--){
        dp[i]=dp[i+1];
        if(A[i]>=A[i+1])
        dp[i]++;
        else
        {
            dp[i]=0;
        }
    }
   cout<<*max_element(dp,dp+n);
}
signed main()
{
   boost
        int test=0,t;
		//cin>>t;
		t=1;
		while(test++ <t){
            //cout<<"Case "<<test<<": ";
            solve();
                           }		
} 
               
			
 

				
		
		




Measured memory_bytes: 25216
X, K, D = map(int, input().split())

if X+K*D < 0:
  print(abs(X+K*D))
elif X-K*D > 0:
  print(abs(X-K*D))
elif X+K*D == 0:
  print(0)
elif X-K*D == 0:
  print(0)
else:
  if X < 0:
    K1 = int(-X/D)+1
    K2 = K-K1
    if not K2 % 2:
      print(abs(X+K1*D))
    else:
      print(min(abs(X+K1*D+D), abs(X+K1*D-D)))
  else:
    K1 = int(X/D)+1
    K2 = K-K1
    if not K2 %2:
      print(abs(X-K1*D))
    else:
      print(min(abs(X-K1*D+D), abs(X-K1*D-D)))

Measured memory_bytes: 9236
def main():
    H, W = map(int, input().split())
    s = ["." * (W + 2)]
    s += ["." + input() + "." for i in range(H)]
    s.append("." * (W + 2))
    for y in range(1, H + 1):
        for x in range(1, W + 1):
            if s[y][x] == ".":
                continue
            if "." == s[y + 1][x]\
                    == s[y][x + 1]\
                    == s[y - 1][x]\
                    == s[y][x - 1]:
                print("No")
                return
    print("Yes")
    return


main()


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

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

    int t;
    static int64_t a[200];
    cin >> t;
    while(t--){
        int n;
        string s;
        cin >> n;
        for(int i=0;i<n;++i) cin >> a[i];
        cin >> s;
        if(s.back() == '1'){ cout << "1\n"; continue; }
        vector<int64_t> b;
        auto add = [&](int64_t x){
            if(b.size() == 0){ b.emplace_back(x); return; }
            b.emplace_back(x);
            sort(b.begin(), b.end(), greater());
            for(size_t i=0;i<b.size();++i){
                for(size_t j=0;j<b.size();++j){
                    if(i == j) continue;
                    int64_t ms = x > 0 ? 1ULL<<(63-__builtin_clzll(b[i])) : 0;
                    if(b[j] & ms) b[j] ^= b[i];
                }
            }
            while(b.back() == 0) b.pop_back();
        };
        auto chk = [&](int64_t x){
            for(size_t i=0;i<b.size();++i){
                int64_t ms = 1ULL<<(63-__builtin_clzll(b[i]));
                if(x & ms) x ^= b[i];
            }
            return x==0;
        };
        int ans = 0;
        for(int i=n-1;i>=0;--i){
            if(s[i] == '0') add(a[i]);
            else if(chk(a[i]) == false){ ans = 1; break; }
        }
        cout << ans << endl;
    }
    return 0;
}

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

int rec(int v, vector<int> *c, int *dp) {
  if (dp[v] != -1)
    return dp[v];

  int ret = 0;
  for (auto &var : c[v]) {
    ret = ret > (rec(var, c, dp) + 1) ? ret : (rec(var, c, dp) + 1);
  }
  return dp[v] = ret;
}

int main(int argc, char const *argv[]) {
  int n, m;
  cin >> n >> m;
  vector<int> *c = new vector<int>[n];

  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    c[x].push_back(y);
  }

  int *dp = new int[n];
  for (int i = 0; i < n; i++) {
    dp[i] = -1;
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans = ans > (rec(i, c, dp)) ? ans : (rec(i, c, dp));
  }

  cout << ans << endl;

  delete[] dp;
  delete[] c;
  return 0;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t x,y,z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

struct dat{
    int node, par;
};

template<class T>
struct union_find{
    int N;
    vector<int> par, rank;
    vector<int> time;
    vector<T> sz;

    union_find(int N, int M) : N(N), par(N + 1), rank(N + 1, 1), time(M + 1, 0), sz(N + 1, 1){
        for(int i = 0; i <= N; ++i) par[i] = i;
    }

    void init(int n, T s){sz[n] = s;}

    int find(int v){
        return (v == par[v] ? v : find(par[v]));
    }

    void unite(int x, int y, int t){
        x = find(x);
        y = find(y);
        if(x == y) return;

        if(rank[x] > rank[y]){
            time[t] = y;
            par[y] = x;
            sz[x] += sz[y];
        }else{
            time[t] = x;
            par[x] = y;
            sz[y] += sz[x];
            if(rank[x] == rank[y]) rank[y]++;
        }
    }

    void cut(int t){
        int u = time[t];
        int v = u;
        while(v != par[v]){
            v = par[v];
            sz[v] -= sz[u];
        }
        par[u] = u;
    }

    T get_sz(int x){
        return sz[find(x)];
    }
};

struct arc{
    int from, to, idx;
    ll Y;
    bool operator < (const arc& e1) const {
        return Y < e1.Y;
    }
    bool operator > (const arc& e1) const {
        return Y > e1.Y;
    }
};

struct edge{
    int to, idx;
    ll Y;
};

int N, M;
ll X[100010];
bool ok[100010], used[100010];
vector<edge> G[100010];

void dfs(int v, ll Y){
    if(used[v]) return;
    used[v] = true;
    for(auto u : G[v]){
        if(u.Y > Y) continue;
        ok[u.idx] = true;
        dfs(u.to, Y);
    }
}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> M;

    union_find<ll> uf(N, M);
    for(int i = 1; i <= N; ++i){
        cin >> X[i];
        uf.init(i, X[i]);
    }

    vector<arc> as;
    for(int i = 1; i <= M; ++i){
        int A, B;
        ll Y;
        cin >> A >> B >> Y;
        as.emplace_back(arc{A, B, i, Y});
        G[A].emplace_back(edge{B, i, Y});
        G[B].emplace_back(edge{A, i, Y});
    }

    sort(as.begin(), as.end());
    for(int i = 0; i < M; ++i){
        uf.unite(as[i].to, as[i].from, i);
    }

    for(int i = M - 1; i >= 0; --i){
        if(ok[as[i].idx]) continue;
        if(uf.get_sz(as[i].to) < as[i].Y){
            uf.cut(i);
        }else{
            dfs(as[i].to, as[i].Y);
            int ans = 0;
        }
    }
    int ans = M;
    for(int i = 1; i <= M; ++i) ans -= ok[i]; 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16176
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if ((a * 100 + b * 10 + c) % 4 == 0)
        cout << "YES";
    else
        cout << "NO";
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int n,m,k,a;
  int l[31] = {};
  int i,j;
  int ans = 0;

  scanf("%d %d",&n,&m);

  for (i = 0; i < n; i++) {
    scanf("%d",&k);

    for (j = 0; j < k; j++) {
      scanf("%d",&a);
      l[a]++;
    }
  }

  for (i = 1; i <= m; i++) {
    //printf("%d\n", l[i]);
    if (l[i] == n) {
      ans++;
    }
  }

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long
#define pii pair<int,int>
#define pb(x) push_back(x)
#define lbound lower_bound
#define ubound upper_bound
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcountll(x)
#define heap_min priority_queue<int,vector<int>,greater<int>>
#define heap_max priority_queue<int>
#define printv(v) for(auto p : v) cout << p << " ";
#define printa(a,n) for(int i = 0 ; i < n ; i++) cout << a[i] << " ";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int32_t main()
{
	int h,w;
	cin >> h >> w;
	char a[h][w];
	for(int i = 0 ; i < h ; i++){
		for(int j = 0 ; j < w ; j++){
			cin >> a[i][j];
		}
	}
	int dp[h][w];
	memset(dp,0,sizeof(dp));
	for(int i = 0 ; i < w ; i++){
		if(a[0][i]=='.'){
			dp[0][i] = 1;
		}
		else{
			break;
		}
	}
	for(int i = 0 ; i < h ; i++){
		if(a[i][0]=='.'){
			dp[i][0] = 1;
		}
		else{
			break;
		}
	}
	for(int i = 1;  i < h ; i++){
		for(int j = 1; j < w ; j++){
			if(a[i][j]=='#'){
				continue;
			}
			dp[i][j] = (dp[i-1][j]+dp[i][j-1])%mod;
		}
	}
	cout << dp[h-1][w-1];
	
}


Measured memory_bytes: 12396
#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++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	int row, col;
	while (cin >> row >> col) {
		if (row == 0 && col == 0)
			break;
		rep(r, row) {
			rep(c, col) {
				if (r == 0 || r == row - 1 || c == 0 || c == col - 1)
					cout << "#";
				else
					cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
}



Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int M=1000003;
int fac[M],inv[M],x,d,n,T;
int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=x*x%M)
		if (y&1)(ans*=x)%=M;
	return ans;	
}
signed main(){
	scanf("%lld",&T);
	fac[0]=inv[0]=1;
	for (int i=1;i<M;i++)fac[i]=i*fac[i-1]%M;
	for (int i=1;i<M;i++)inv[i]=ksm(fac[i],M-2);
	while (T--){
		scanf("%lld%lld%lld",&x,&d,&n);
		if (!d){
			printf("%lld\n",ksm(x,n));
			continue;
		}
		(x*=ksm(d,M-2))%=M;
		if (x+n-1>=M){
			puts("0");
			continue;
		}
		printf("%lld\n",ksm(d,n)*fac[x+n-1]%M*(x==0?1:inv[x-1])%M);
	}
	return 0;
}

Measured memory_bytes: 16512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    int n,k;
    cin >> n >> k;
    int g;
    cin >> g;
    int max=g;
    rep(i,n-1) {
        int a;
        cin >> a;
        chmax(max, a);
        g = __gcd(g,a);
    }
    if(k > max) cout << "IMPOSSIBLE" << endl;
    else if(k%g == 0) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 256
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
import re

n = ii()
s = input()
s = s+s[0]
#最初2つがSS/SW/WS/WWの状態で、前から決めてく
#S=1,W=0
l = [[1,1],[1,0],[0,1],[0,0]]
'''
ss = [1,1]
sw = [1,0]
ws = [0,1]
ww = [0,0]
'''

def nextAnimal(lis,st):
    if st == 'o':
        lis.append(lis[-2]^(lis[-1]^1))
    else:
        lis.append(lis[-2]^(lis[-1]))
#    print(lis)


for i in s[1:]:
    for item in l:
        nextAnimal(item,i)

#print(l)
for item in l:
    if item[0] == item[-2] and item[1] == item[-1]:
        ans = ''
        for i in item[:n]:
            if i == 0:
                ans += 'W'
            else:
                ans += 'S'
        print(ans)
        exit()
print(-1)

Measured memory_bytes: 13816
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
 
#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.size()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>());
#define VSORT(v) sort(v.begin(),v.end());
#define VGSORT(v) sort(v.begin(),v.end(),greater<int>());
#define REV(a) reverse(begin(a),end(a));
#define FIND(v,i) find(v.begin(),v.end(),i);

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////
	int n,m;
    cin >> n;
    int t[n];
    REP(i,n) cin >> t[i];
    cin >> m;
    int p[m],x[m];
    REP(i,m) cin >> p[i] >> x[i];
    REP(i,m){
        int ans=0;
        REP(j,n){
          	if(j==p[i]-1) ans+=x[i];
            else ans+=t[j];
        }
        cout << ans << endl;
    }

/////////////////////////////////////////////
}

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

int main() {
    int t,x,n,ans;
    cin>>n>>x>>t;
    if (n%x!=0)
        ans=(n/x+1)*t;
    else
        ans=n/x*t;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>

using namespace std;
int main(){

  string str;
  getline(cin , str); 

  for(int i=0;i<str.size();i++){
    if(65<= str[i] && str[i] <= 90){
      str[i] = (char)((int)str[i] + 32);
    }else if(97 <= str[i] && str[i] <= 122 ){
      str[i] = (char)((int)str[i] - 32 );
    }
    cout << str[i];
  }
  cout << endl;

}


Measured memory_bytes: 3160
#define _USE_MATH_DEFINES
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;

int main() {
	int n, m;
	int t[105] = {};


	cin >> n;

	for (int i = 1; i <= n; i++)
	{
		cin >> t[i];
	}

	cin >> m;
	for (int i = 0; i < m; i++)
	{
		int p, x;
		int ans = 0;
		cin >> p >> x;

		for (int i = 1; i <= n; i++)
		{
			if (p == i) {
				ans += x;
			}
			else {
				ans += t[i];
			}
		}

		cout << ans << endl;
		
	}

	
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

const double EPS=1e-10;

int main()
{
	int res[4][2]={};
	for(double a[2];cin>>a[0]>>a[1];){
		rep(i,2)
			if(a[i]+EPS>1.1)
				res[0][i]++;
			else if(a[i]+EPS>0.6)
				res[1][i]++;
			else if(a[i]+EPS>0.2)
				res[2][i]++;
			else
				res[3][i]++;
	}
	rep(i,4)
		cout<<res[i][0]<<" "<<res[i][1]<<endl;
	
	return 0;
}

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

using namespace std;

int partition(vector<int> &a, const int p, const int r)
{
    int x = a[r];
    int i = p - 1;
    for (int j = p; j < r; j++)
    {
        if (a[j] <= x)
        {
            i++;
            swap(a[i], a[j]);
        }
    }
    swap(a[i + 1], a[r]);
    return i + 1;
}

int main()
{
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }

    int key = partition(a, 0, n - 1);
    for (int i = 0; i < n; i++)
    {
        if (i == key)
            printf("[");
        printf("%d", a[i]);
        if (i == key)
            printf("]");
        if (i != n - 1)
            printf(" ");
    }
    printf("\n");

    return 0;
}



Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define endl "\n"

int32_t main()
{
	fast;
	int m, n;
	cin>>n>>m;
	vector<vector<int>> v(m+1);
	vector<int> a(n);
	for(int i=0;i<n;i++)
	{
		int a, b;
		cin>>a>>b;
		if(a<=m)
			v[a].push_back(b);
	}
	// for(int i=0;i<n;i++)
	// {
	// 	int x;
	// 	cin>>x;
	// 	int y=a[i];
	// 	if(y<=m)
	// 		v[y].push_back(x);
	// }
	for(int i=0;i<m;i++)
	{
		sort(v[i+1].begin(), v[i+1].end(), greater<int>());
	}
	multiset<int> s;
	for(int i=m;i>=1;i--)
	{
		if(v[i].size()==0)
			continue;
		// int j=0;
		for(int j=0;j<(int)v[i].size();j++)
		{
			s.insert(v[i][j]);
			// cout<<i<<' '<<v[i][j]<<' '<<s.size()<<endl;
			if(s.size()>m-i+1)
			{
				// cout<<*(s.begin())<<" HEY"<<endl;
				s.erase(s.begin());
			}
		}
	}
	int c=0;
	for(auto i:s)
		c+=i;
	cout<<c<<endl;
}

Measured memory_bytes: 10880
while 1:
    try:
        a,b=map(int,input().split())
        root=[[-1 for i in range(a+1)] for j in range(b+1)]
        for i in range(a+1):
            root[0][i]=0
        for i in range(b+1):
            root[i][0]=0
        root[1][1]=1
        for xx in range(int(input())):
            x,y=map(int,input().split())
            root[y][x]=0
        for n in range(3,a+b+3):
            for i in range(1,a+1):
                if 0 < n-i < b+1:
                    if root[n-i][i]==0:continue
                    else:
                        root[n-i][i]=root[n-i][i-1]+root[n-i-1][i] 
        print(root[-1][-1])
    except:break


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved

int main(){
    int n;
    cin>>n;
    int p[n];

    rep(i,n)cin>>p[i];

    map<int,int>next;
    rep(i,n){
        auto it=next.find(p[i]);
        if(it==next.end()){
            next.emplace(make_pair(p[i]+1,1));
        }
        else{
            int num=it->second;
            num++;
            next.erase(it);
            next.emplace(make_pair(p[i]+1,num));
        }
    }
    auto iter=next.begin();
    int k=-1;
    while(iter!=next.end()){
        k=max(k,iter->second);
        iter++;
    }
    //cout<<endl;
    cout<<n-k<<endl;
    return 0;

}
/*


*/


Measured memory_bytes: 10368
N, A, B, C, D = map(int, input().split())
S = input()

if C < D:
    if '##' not in S[A - 1:D]:
        print('Yes')
    else:
        print('No')
else:
    if '##' not in S[A - 1:C] and '...' in S[B - 2: D + 1]:
        print('Yes')
    else:
        print('No')

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


int main(){ 
    string S;
    cin >> S;
    int N;
    N = S.size() + 1;

    vector<int> A(N,0);

    rep1(i,N-1) {
        if (S[i-1] == '<') {
            A[i] = max(A[i], A[i-1]+1);
        }
    }

    rep1(i,N-1) {
        if (S[N-1-i] == '>') {
            A[N-1-i] = max(A[N-1-i], A[N-i]+1);
        }
    }

    Int ans = 0;

    rep(i,N) ans += A[i];

    cout << ans << endl;
}


Measured memory_bytes: 2820
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    long t=0,n=0,c=0;
    foreach(a;stdin.byLine().map!(s=>s.split(",").map!(to!int).array())())
    {
        t+=a[0]*a[1];
        n+=a[1];
        ++c;
    }
    writeln(t);
    writeln((n+c/2)/c);
}

Measured memory_bytes: 1072
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int       lint;
typedef vector<int>         vi;
typedef vector<lint>        vl;
typedef pair<int, int>      pii;
typedef vector<pii>         vii;
typedef set<int>            si;
typedef map<string, int>    msi;
 
#define pb(n)           push_back(n)
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define M               10000000
#define MOD             10000007
#define INF             1e9+7
#define REP(i,a,b)      for(int i = int(a); i <= int(b); i++)
#define REPL(i,a,b)     for(lint i = lint(a); i <= lint(b); i++)
#define fastIO()        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int main()
{
    long double a, b, c;
    cin>>a>>b>>c;

    long double eps = 1.0E-14;//fortright48

    if(sqrt(a) + sqrt(b) + eps< sqrt(c)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}


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

int main(){

    int n,count=0; cin>>n;

    vector<int> sec(n);

    vector<int> ksec(n);

    string ans;

    for(int i=0; i<n; i++){

        cin>>sec.at(i);

        ksec.at(i) = sec.at(i);
    }

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

    for(int i=0; i<n; i++){
        if(ksec.at(i) == sec.at(i)) count++;
    }

    for(int i=0; i<n; i++){

        if(count == n) {
            ans = "YES";
            break;
        }

        for(int j=0; j<n; j++){

            swap(sec.at(i),sec.at(j));

            count =0;

            for(int k=0; k<n; k++){

                if(sec.at(k) == ksec.at(k)) count++;
           }

           if (count == n){
                ans = "YES";
                break;   
           } 

           else if (count != n) swap(sec.at(i),sec.at(j));
        }

        if( ans == "YES") break;
    }

    if (ans != "YES" ) cout<<"NO"<<endl;

    else cout<<ans<<endl;

    return 0;


}

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

int main()
{
    int d;
    cin >> d;
    int c[26];
    for(int i = 0; i < 26; i++) cin >> c[i];
    int s[400][26];
    for(int i = 0; i < d; i++){
        for(int j = 0; j < 26; j++) cin >> s[i][j];
    }
    int last[26];
    for(int i = 0; i < 26; i++) last[i] = -1;
    for(int i = 0; i < d; i++){
        bool f = false;
        for(int j = 0; j < 26; j++){
            if((i - last[j]) * c[j] >= 2000){
                f = true;
                last[j] = i;
                cout << j + 1 << endl;
                break;
            }
        }
        if(f) continue;
        int l = 0;
        for(int j = 0; j < 26; j++){
            if(s[i][j] - (i - last[j]) * c[j] > s[i][l] - (i - last[j]) * c[j]) l = j;
        }
        last[l] = i;
        cout << l + 1 << endl;
    }
}


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

int N, A, B, C;

int dfs(int n, int a, int b, int c, const vector<int>& l) {
    if (n == N) {
        if (a == 0 || b == 0 || c == 0) return pow(10, 9);
        return abs(A - a) + abs(B - b) + abs(C - c) - 30;
    }
    int r0 = dfs(n+1, a, b, c, l);
    int r1 = dfs(n+1, a+l[n], b, c, l) + 10;
    int r2 = dfs(n+1, a, b+l[n], c, l) + 10;
    int r3 = dfs(n+1, a, b, c+l[n], l) + 10;
    return min({r0, r1, r2, r3});
}
 
int main() {
    cin >> N >> A >> B >> C;
    vector<int> l(N);
    for(int i=0; i<N; i++){
        cin >> l[i];
    }
 
    cout << dfs(0, 0, 0, 0, l) << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,a,b,c=MI()
mn=inf
lis=[I() for i in range(n)]
for i in list(product([0,1,2,3],repeat=n)):
    x=[]
    y=[]
    z=[]
    for j in range(n):
        if i[j]==0:
            x.append(lis[j])
        elif i[j]==1:
            y.append(lis[j])
        elif i[j]==2:
            z.append(lis[j])
    if len(x)==0 or len(y)==0 or len(z)==0:
        ans=inf
    else:
        ans=abs(sum(x)-a)+10*(len(x)-1)+abs(sum(y)-b)+10*(len(y)-1)+abs(sum(z)-c)+10*(len(z)-1)
    #print(ans)
    if ans<mn:
        mn=ans
        X=x
        Y=y
        Z=z
print(mn)
'''print(X)
print(Y)
print(Z)
'''

Measured memory_bytes: 11252
#include<iostream>
#include<algorithm>>

using namespace std;
int main() {
	int n, x;
	cin >> n >> x;
	int m;

	int mn = 10000;
	int sum = 0;

	for (int i = 0; i < n; i++) {
		cin >> m;
		mn = min(m, mn);
		sum += m;
	}
	x -= sum;

	x /= mn;

	cout << x + n << endl;

	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]

X = [] # 足りてる
d = 0
c = 0

for i in range(N):
    if A[i] > B[i]:
        X.append(A[i]-B[i])
    elif A[i] < B[i]:
        d += B[i] - A[i]
        c += 1

if sum(X) < d:
    print(-1)
else:
    X = sorted(X)[::-1]
    i = 0
    while d > 0:
        d -= X[i]
        i += 1
        c += 1
        
    print(c)

Measured memory_bytes: 19068
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 




////////////////////////////////////////////////////////


int main() {
    ll n; cin >> n;
    ll now = 0;
    map<ll, ll> ma;
    ma[0]++;
    rep(i, 0, n){
        ll a; cin >> a;
        now += a;
        ma[now]++;
    }
    ll ans = 0;
    for(auto m : ma){
        ll num = m.second;
        ans += (num*(num-1))/2;
    }
    co(ans);

    return 0;
}


Measured memory_bytes: 12800
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
using namespace std;

#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)

int a, b, c, d;
string ans;

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

  if (a+b > c+d) {
    ans = "Left";
  } else if (a+b == c+d) {
    ans = "Balanced";
  } else {
    ans = "Right";
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

K = I()

if K % 2 == 0:
    print(-1)
    exit()

a = [0] * 10**7
a[0] = 7%K

for i in range(1, K+1):
    a[i] = (a[i-1] * 10 + 7) % K

for i in range(K+1):
    if a[i] == 0:
        print(i+1)
        exit()

print(-1)


Measured memory_bytes: 136584
#include<bits/stdc++.h>
#define LL long long
#define ULL unsigned  long long
#define maxn (LL)1e7
#define INF 0x3f3f3f3f
#define inf 0x7fffffff
#define PI  acos(-1.0)
#define pb push_back
#define re register LL
const double eps = 0.0000001;
using namespace std;
typedef pair<LL,LL> pii;
typedef long long ll;
const ll N=1e5+5;
ll a[N];
ll max(ll a,ll b)
{
    if(a>b)
    return a;
    else return b;
}
int main()
{
    ll n;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    ll flag=0,m=0;
    for(ll i=1;i<n;i++)
    {
        if(a[i]>=a[i+1]) flag++;
        if(i==n-1) m=max(m,flag);
        if(a[i]<a[i+1]){m=max(m,flag);flag=0;}
    }
    cout<<m;
}


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

int main(){
	int n, a, i, ans=0;
	int b[100010]={};
	cin>>n;
	for(i=1; i<=n; i++){
		cin>>a;
		b[a]++;
	}
	for(i=1; i<100000; i++) ans=max(ans, b[i-1]+b[i]+b[i+1]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N, A, B;


int main(){
  cin.sync_with_stdio(false);
  cin >> N >> A >> B;
  if( B < A){
    cout << 0 << endl;
  }else if (N == 1 && A != B){
    cout << 0 << endl;
  }else{
    cout << (B*(N-1) + A - (A*(N-1) + B)) + 1 << endl;
  }


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
const int MOD = 1000000007;
template<class T> void add(T &a, T b) { a = (a + b) % MOD; }

int main() {
    int N; cin >> N;
    vector<vector<int>> A(N, vector<int>(N));
    rep(i, 0, N) rep(j, 0, N) cin >> A[i][j];
    vector<int> dp(1 << N);
    dp[0] = 1;
    rep(bit, 0, 1 << N) if(dp[bit]) {
        int n = __builtin_popcount(bit);
        if(n < N) {
            rep(i, 0, N) if(A[n][i] && !(bit & (1 << i))) {
                add(dp[bit | (1 << i)], dp[bit]);
            }
        }
    }
    cout << dp[(1 << N) - 1] << '\n';
    return 0;
}


Measured memory_bytes: 8448
import sys
import numpy as np

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    X, Y = map(int, readline().split())
    if X%3==Y%3==1 or X%3==Y%3==2:
        print(0)
        sys.exit()
    a = (2*Y-X)//3
    b = (2*X-Y)//3


    N = a+b
    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]

    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % MOD)
        inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
        factinv.append((factinv[-1] * inv[-1]) % MOD)

    def cmb(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n - r] % mod

    print(cmb(N, a, MOD))


if __name__ == '__main__':
    main()


Measured memory_bytes: 105872
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

int main() {
  int N;
  cin >> N;
  int m = 0;
  int ans = 0;
  REP(i, N) {
    int H;
    cin >> H;
    if (m <= H) ans++;
    m = max(m, H);
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
n,m=map(int,input().split())
a=[0]+list(map(int,input().split()))
a[0]%=m
for i in range(1,n+1):
	a[i]+=a[i-1]
	a[i]%=m
a.sort()
p=0
s=0
for i in range(1,n+1):
	if a[i]-a[p]:
		p=i-p
		s+=p*(p-1)
		p=i
p=n-p
s+=p*(p+1)
print(int(s/2))

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
int s[55],a[55];
int main(){
    int n,x;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&x);
        s[i]=s[i-1]+x;
        a[i]=a[i-1]+s[i-1]*x;
    }
    printf("%d",a[n]);
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a%mod; a = a * a%mod; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// head
ll exgcd(ll a, ll b, ll& x, ll& y)
{
    ll d=a;
    if(b!=0){
        d=exgcd(b,a%b,y,x);
        y-=(a/b)*x;
    }else{
        x=1;y=0;
    }
    return d;
}

ll mod_inverse(ll a, ll m)
{
    ll x, y;
    exgcd(a, m, x, y);
    return (m + x % m) % m;
}
const int MAXN = 200000+5;

ll getC(ll n, ll a) {
    ll up = 1;
    for(int i=0;i<a;++i) {
        up=up*(n-i)%mod;
    }
    ll dd = 1;
    for(int i=1;i<=a;++i) {
        dd =dd*i%mod;
    }
    ll ndd = mod_inverse(dd, mod);
    return up*ndd%mod;
}
int t;

int main()
{
    ios::sync_with_stdio(false);
#ifdef RG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
#endif
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans = powmod(2,n)-1;
    ans = (ans+mod) % mod;
    ans -= getC(n,a);
    ans = (ans+mod) % mod;
    ans -= getC(n,b);
    ans = (ans+mod) % mod;
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
    int k, a, b;
    std::cin >> k >> a >> b;
    int kk = k;
    while (kk <= b) {
        if (a <= kk) {
            std::cout << "OK" << std::endl;
            return 0;
        }
        kk += k;
    }
    std::cout << "NG" << std::endl;
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n;
    cin >> n;
    int sum = 0;
    rep(i, n)
    {
        int a, b;
        cin >> a >> b;
        sum += b - a + 1;
    }

    OP(sum);
    return 0;
}

Measured memory_bytes: 256
from math import atan,pi
a,b,x = map(int,input().split())

ans = 0
if x >= a*a*b/2:
    ans = atan(2*b/a-2*x/a**3)/pi*180
else:
    ans = atan(a*b**2/2/x)/pi*180

print(ans)

Measured memory_bytes: 38384
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>
#include <cstring>

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

int main() {
    ll n, d;
    cin >> n >> d;
    int ans = 0;
    rep(i, n) {
        double x, y;
        cin >> x >> y;
        double dist = x*x + y*y;
        if (d*d >= dist) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3716
#include <stdio.h>

int main(void){
    int a, b;

    scanf("%d %d", &a, &b);
    if(a == b){
      printf("a == b\n");
    } else if(a < b){
      printf("a < b\n");
    } else{
      printf("a > b\n");
    }

    return 0;
}

Measured memory_bytes: 1784
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>
#include <array>
#include <stack>

using namespace std;

//???????????°??????TEST????????????????????¬???????????????????????????????????¢????????????
//#define TEST //*******************************************************************************************************************************************

//?????????????????¨??§?????\????????????????????????????????°?????????????¨???????????????????dout???????????????????????§???????????¬??????????????????????????????????????????
#ifdef TEST
    #define dout cout
#else
    stringstream dummy; //???????????°??????dout?????????????????????????????????
    #define dout dummy.str(""); dummy.clear(stringstream::goodbit); dummy //dummy?????????????????????????????????????????¨?????¢?????¢???????????????
    //???????????¨??????????????????goodbit?????????????????????????????¨???????????´????????????????????????????????¨?????°?????????????????§???????????????????????????????????? http://d.hatena.ne.jp/linden/20060427/p1
#endif


int main(void) {
    stack<int> stack;
    
    string str;
    
    
    while(cin >> str) {
        int a, b;
        
        if (str == "+") {
            b = stack.top(); stack.pop();
            a = stack.top(); stack.pop();
            
            stack.push( a+b );
        }
        else if (str == "-") {
            b = stack.top(); stack.pop();
            a = stack.top(); stack.pop();
            
            stack.push( a-b );
        }
        else if (str == "*") {
            b = stack.top(); stack.pop();
            a = stack.top(); stack.pop();
            
            stack.push( a*b );
        }
        else {
            stack.push( atoi( str.c_str() ) );
        }
    }
    
    dout << "display stack\n";
    while(!stack.empty()) {
        cout << stack.top() << endl;
        stack.pop();
    }
    dout << "end of stack\n\n";

    
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define MAX 100000000000000
#define INF 1000000 
#define M 1000000007
#define Pi 3.14159265 
using namespace std; 
int main(){ 
   FAST
   ll n;
   cin>>n;
   ll ans = 0;
   for(ll i = 1;i<n;i++){
      for(ll j = i;j<n;j+=i){
         ans++;
      }
   }
   cout<<ans<<endl;
   return 0;
} 

Measured memory_bytes: 3684
import statistics
n=int(input())
alist=list(map(int, input().split()))
blist=[]
for i in range(n):
  blist.append(alist[i]-i-1)
blist.sort()
median=statistics.median_high(blist)
ans=0
for i in range(n):
  ans+=abs(blist[i]-median)
print(ans)

Measured memory_bytes: 33860