akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll INF = 1000000009;
ll MOD = 1000000007;


void solve(){

    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    bool b_;
    while(a>0&&b>0){
        c -= b;
        if(c<=0) {
            b_=true;
            break;
        }
        a -= d;
        if(a<=0){
            b_=false;
            break;
        }
    }

    if(b_) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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


Measured memory_bytes: 3640
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int
#define ld long double

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10
#define PI acos(-1LL)

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	int n;
	cin>>n;

	int last=-1;

	for(i=0;i<62;i++)
	{
		if(n&(1LL<<i))
		{
			last=i;
		}
	}

	d(last);
	last++;
	int k=(1LL<<last)-1;

	// int ans=(1LL<<(k))-1;
	cout<<k<<endl;

}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

#define MAX_N 100010
#define MAX_M 100010

ll N, M;
ll X[MAX_M], Y[MAX_M], Z[MAX_M], parent[MAX_N], ranked[MAX_N];

void init(ll n) {
    for (ll i = 0; i < n; i++) {
        parent[i] = i;
        ranked[i] = 0;
    }
}

ll root(ll x) {
    if (parent[x] == x) {
        return x;
    } else {
        return parent[x] = root(parent[x]);
    }
}

bool same(ll x, ll y) {
    return root(x) == root(y);
}

void unite(ll x, ll y) {
    x = root(x);
    y = root(y);

    if (x == y) {
        return;
    }

    if (ranked[x] < ranked[y]) {
        parent[x] = y;
    } else {
        parent[y] = x;
        if (ranked[x] == ranked[y]) {
            ranked[x]++;
        }
    }
}

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> M;
    rep (i, M) {
        cin >> X[i] >> Y[i] >> Z[i];
        X[i]--;
        Y[i]--;
    }

    init(N);

    rep (i, M) {
        unite(X[i], Y[i]);
    }

    set<ll> s;
    rep (i, N) {
        s.insert(root(i));
    }

    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 8832
# include <bits/stdc++.h>
using namespace std;
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0)
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n;
    fi>>n;
    vector < int > s(n + 5,0);
    for (int i = 1;i <= n;++i) fi>>s[i];
    ll ans = 1e18;
    for (int k = -1000;k <= 1e3;++k)
    {
        ll cnt = 0;
        for (int i = 1;i <= n;++i)
            cnt += (k - s[i]) * (k - s[i]);
        ans = min(ans,cnt);
    }
    fo << ans << '\n';
    return 0;
}




Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn main() {

    let (n, m) = {
            let s = {
                let mut s = String::new();
                std::io::stdin().read_line(&mut s).unwrap();
                s.trim_right().to_owned()
            };
            let mut ws = s.split_whitespace();
            let n: usize = ws.next().unwrap().parse().unwrap();
            let m: usize = ws.next().unwrap().parse().unwrap();
            (n, m)
    };
    let mut ms = vec![0; m];

    for _ in 0..n {
        let s = {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            s.trim_right().to_owned()
        };
        let mut ws = s.split_whitespace();
        let k = ws.next().unwrap().parse().unwrap();
        for _ in 0..k {
            let tmp: i64 = ws.next().unwrap().parse().unwrap();
            ms[(tmp - 1) as usize]+=1;
        }
    }
    let mut res = 0;
    for i in 0..m {
        if ms[i] == n {
            res+=1;
        }
    }
    println!("{}", res);
}

Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class Program
{
    #region Standard I/O
    readonly TextReader input;
    readonly TextWriter output;

    X[] ReadLine<X>(Func<string, X> func)
    {
        return input.ReadLine().Split(' ').Select(func).ToArray();
    }

    void WriteLineOne(object obj)
    {
        output.WriteLine("{0}", obj);
    }

    void WriteLineMany(params object[] objects)
    {
        output.WriteLine(string.Join(" ", objects.Select(obj => obj.ToString())));
    }
    #endregion

    int n, m;
    int[] xs;
    int[] ys;

    void Read()
    {
        {
            var l = ReadLine(int.Parse);
            n = l[0];
            m = l[1];
        }

        xs = new int[m];
        ys = new int[m];

        for (var i = 0; i < m; i++)
        {
            var l = ReadLine(int.Parse);
            xs[i] = l[0] - 1;
            ys[i] = l[1] - 1;
        }
    }

    bool Solve()
    {
        var middles = new HashSet<int>();
        for (var i = 0; i < m; i++)
        {
            if (ys[i] == n - 1)
            {
                middles.Add(xs[i]);
            }
        }

        for (var i = 0; i < m; i++)
        {
            if (xs[i] == 0)
            {
                if (middles.Contains(ys[i])) return true;
            }
        }

        return false;
    }

    public void Run()
    {
        Read();
        WriteLineOne(Solve() ? "POSSIBLE" : "IMPOSSIBLE");
    }

    public Program(TextReader input, TextWriter output)
    {
        this.input = input;
        this.output = output;
    }

    public static void Main(string[] args)
    {
        new Program(Console.In, Console.Out).Run();
    }
}


Measured memory_bytes: 23184
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;
 
class Program
 {

      
        static void Main(string[] args)
        {
          //入力を受け取る
          var ABX = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
          double a = ABX[0];
          double b = ABX[1];
          double X = ABX[2];
          
          double capa = a*a*b;
          
          double ans = 0D;
          if(capa/2 <= X){
            double tmp = a*a*a;
            double hiki = 2*(a*a*b-X)/(tmp);
            //Console.WriteLine(hiki);
            ans = (double) Math.Atan(hiki);

          }else{
            ans = (double) Math.Atan((a*b*b)/(2*X));
            //Console.WriteLine(ans);
          }

          ans = ans*180/((double) Math.PI);
          string res = ans.ToString("F10");
          
          Console.WriteLine(ans);
        }
}


Measured memory_bytes: 13268
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

// C - Distinct or Not
// https://atcoder.jp/contests/abc154/tasks/abc154_c
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());
        Set<Integer> set = new HashSet<>();
        for (int i = 0;i<N;i++) {
            set.add(Integer.parseInt(scanner.next()));
        }
        scanner.close();

        System.out.println(N == set.size() ? "YES" : "NO");
    }
}


Measured memory_bytes: 68152
n=list(input())
a=[] 
b=[] 
c=0
for i in range(len(n)):
    if n[i]=="," or n[i]=="." or n[i]==" ":
        if 6>=c>=3:
            b=b+a+[" "]
        a.clear()
        c=0
    else:
        a.append(n[i])
        c+=1
del b[-1]
for i in range(len(b)):
   print(b[i],end="")
print()


Measured memory_bytes: 5600
#include <iostream>
#include <cassert>
#include <algorithm>

using namespace std;

uint32_t gcd(const uint32_t &a, const uint32_t &b) {
  uint32_t x = a;
  uint32_t y = b;

  if (y > x) {
    swap(x, y);
  }

  while (x >= y && y != 0) {
    uint32_t tmp = y;
    y = x % y;
    x = tmp;
  }

  return x;
}

int main(int argc, char *argv[]) {
  uint32_t a, b;

  cin >> a >> b;

  cout << gcd(a, b) << endl;

  return 0;
}

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


// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

const int MOD = 1000000007;
using mint = Fp<MOD>;


int N, M;
vector<int> S, T;
mint dp[2100][2100];
mint sdp[2100][2100];

int main() {
    cin >> N >> M;
    S.resize(N), T.resize(M);
    for (int i = 0; i < N; ++i) cin >> S[i];
    for (int i = 0; i < M; ++i) cin >> T[i];

    memset(dp, 0, sizeof(dp));
    memset(sdp, 0, sizeof(dp));
    dp[0][0] = 1;
    sdp[1][1] = 1;
    for (int i = 0; i <= N; ++i) {
        for (int j = 0; j <= M; ++j) {
            if (i == 0 && j == 0) continue;
            if (i-1 >= 0 && j-1 >= 0 && S[i-1] == T[j-1]) {
                dp[i][j] = sdp[i][j];
            }
            sdp[i+1][j+1] = sdp[i+1][j] + sdp[i][j+1] - sdp[i][j] + dp[i][j];
        }
    }
    cout << sdp[N+1][M+1] << endl;
}

Measured memory_bytes: 69248
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
dif = 1000
for i in range(N):
    Tx = T - H[i] * 0.006
    if  abs(Tx - A) < dif:
        dif = abs(Tx - A)
        ans = i + 1
print(ans)

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

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

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    int N; cin >> N;
    string S; cin >> S;
    // N人より西にリーダーがいた場合を初期コストとする
    int cost = count(S.begin(), S.end(), 'E');
    int ans = cost;
    REP(i, N){
        // リーダーの左隣の人がWを向いている場合コストが1増える
        if(i && S[i - 1] == 'W'){
            cost++;
        }
        // リーダーの人がEを向いていた場合コストが1減る
        if(S[i] == 'E') {
            cost--;
        }
        // コストが最小だった場合は更新
        ans = min(ans, cost);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 720
N, A, B = map(int,input().split())

ans = 0
for i in range(N + 1):
    sho = i
    total = 0
    while(sho > 0):
        yo = sho % 10
        sho = sho // 10
        total += yo
    if total >= A and total <= B:
        ans += i
        
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  string S;
  cin >> S;

  vector<int> abc(3, 0);

  rep(i, 3) { abc[S[i] - 'a']++; }

  bool ok = true;
  rep(i, 3) {
    if (abc[i] != 1) ok = false;
  }

  if (ok) {
    cout << "Yes" << endl;

  } else {
    cout << "No" << endl;
  }
}

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

using namespace std;

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

#define All(x) (x).begin(),(x).end()
int GCD(int a,int b){ return b ? GCD(b,a%b) : a ;} 

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1e9;

int main(){
   int n,k;
   cin >> n >> k;
   double ans = k;
   if(n == 1){
      printf("%.0f",ans);
   }else{
      ans = k * pow(k-1,n-1);
      printf("%.0f",ans);
   }
   return 0;
}

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

int main() {
    std::string S;
    std::cin >> S;

    int count = 0;
    for(int i=0;i<S.length();i++){

        //std::cout << S[i] << " "<< S[S.length()-i-1] << std::endl;
        if(S[i] != S[S.length()-i-1]){
            count += 1;
        }
    }

    count /= 2;

    std::cout << count << std::endl;

    return 0;
}

Measured memory_bytes: 256
n, c, k = map(int, input().strip().split())
ts = sorted([int(input()) for _ in range(n)])

buses = 0
passengers = 1
first = ts[0]
for t in ts[1:]:
    if t > first + k or passengers == c:
        buses += 1
        passengers = 1
        first = t
    else:
        passengers += 1

if passengers > 0:
    buses += 1

print(buses)


Measured memory_bytes: 8256
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int n,k;
cin >> n >> k;
vector<long long int> h(n);
for(long long int i = 0; i<n;i++){
    cin >> h.at(i);
}

long long int num = 0;

sort(h.begin(),h.end());
reverse(h.begin(),h.end());
/*
for(int i = 0;i < n ;i++){
    cout << h.at(i) << endl;
}*/

for(long long int i = 0;i < n;i++){
    if(i >= k){
        num += h.at(i);
    }
}

cout << num << endl;


return 0;
}

Measured memory_bytes: 1792
#include <iostream>

int gcd(int x, int y){

  if( (x % y) != 0 )
    return gcd(y, (x % y));
  else
    return y;

}


int main(){

  int x, y;

  std::cin >> x >> y;

  std::cout << gcd(x, y) << std::endl;

  return 0;

}

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

int main(){
    int n;
    cin >> n;
    int a[10000];
    for(int i=0;i<10000;i++) a[i]=0;
    int i=0;
    while(1){
        i++;
        a[i]=a[i-1]+i;
        if(a[i]>n) break;
    }
    int b=0;
    while(1){
        if(a[b]<n&&a[b+1]>=n) break;
        b++;
    }
    int c=a[b+1]-n;
    for(int i=1;i<=b+1;i++){
        if(i==c) continue;
        else cout << i << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0): d(n,-1) {}
    int find(int x) { 
      if (d[x] < 0) return x;
      return d[x] = find(d[x]);
    }
    bool unite(int x, int y) {
      x = find(x); y = find(y);
      if (x == y) return false;
      if (d[x] > d[y]) swap(x,y);
      d[x] += d[y];
      d[y] = x;
      return true;
    }
    bool same(int x, int y) { return find(x) == find(y);}
    int size(int x) { return -d[find(x)];}
};

int main() {
    int n,m;
    cin >> n >> m;
    UnionFind uf(n);
    rep(i,m) {
        int x,y,z;
        cin >> x >> y >> z;
        x--;y--;
        uf.unite(x,y);
    }
    set<int>se;
    rep(i,n) {
        se.insert(uf.find(i));
    }
    int ans = se.size();
    cout << ans << endl;
}

Measured memory_bytes: 8304
import java.util.*;
import java.io.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		if(a < 1200) System.out.println("ABC"); 
		else if(a >= 1200 && a< 2800) System.out.println("ARC"); 
		else System.out.println("AGC");
	}
}

Measured memory_bytes: 21588
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 200000;
int n;
int a[MAX_N];

int main() {
    fastio();

    cin >> n;
    forn(i, n) cin >> a[i];

    int c = count(a, a + n, 1);
    if (c == 0) {
        cout << -1 << endl;
        return 0;
    }

    int k = 1;
    forn(i, n) {
        if (a[i] == k) {
            k++;
        }
    }

    cout << n - (k - 1) << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define f1(a,b,c) for(int c=a;c<=b;c++)
#define f2(a,b,c) for(int c=a;c>=b;c--)
#define f3(a,b,c) for(int c=a;c;c=b)
#define so1(a,n) sort(a+1,a+n+1,mycmp);
#define so2(a,n) sort(a+1,a+n+1);
#define ll long long
#define itn int
#define ubt int 
const int twx=+100;
const int inf=0x7fffffff;
ll read()
{
    ll sum=0;
    ll flag=1;
    char c=getchar();
    while(c<'0'||c>'9')
    {
        if(c=='-')
        {
            flag=-1;
        }
        c=getchar();
    }
    while(c>='0'&&c<='9')
    {
        sum=((sum*10)+c-'0');
        c=getchar();
    }
    return sum*flag;
}
int a,b;
int ans;
void init()
{
	a=read();
    b=read();
}
void work()
{
	ans=a-b*2;
    ans=max(ans,0);
}
void print()
{
	printf("%d\n",ans);
}
int main()
{
    init();
    work();
    print();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    // Your code here!
    ll n;
    cin>>n;
    vector<pair<string,pair<ll,ll>>> a(n);
    rep(0,i,n){
        cin>>a[i].first>>a[i].second.first;
        a[i].second.second=i;
        a[i].second.first=-a[i].second.first;
    }
    sort(a.begin(),a.end());
    rep(0,i,n){
        cout<<a[i].second.second+1<<endl;
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

# In[10]:


from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN


# In[25]:


N = int(input())
a = list(map(int, input().split()))


# In[26]:


x = int(Decimal(str(sum(a)/N)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
ans = 0
for i in range(N):
    ans += (x-a[i])**2
print(ans)


# In[ ]:






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

typedef long long ll;

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

    int n; cin >> n;
    int ans = 0;
    for(int i=0;i<n;i++){
        int l,r;
        cin >> l >> r;
        ans += r-l+1;
    }
    cout << ans << endl;
    return 0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

void eratosthenes(int n, vector<bool> &isPrime){
    isPrime.resize(n + 1, true);
    for(int i = 0 ; i < 2 ; ++i){
        isPrime[i] = false;
    }
    for(int i = 2 ; i * i <= n ; ++i){
        if(isPrime[i]){
            for(int j = i ; i * j <= n ; ++j){
                isPrime[i * j] = false;
            }
        }
    }
    return;
}

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

    int n;
    while(cin >> n, n){

        vector<bool> isPrime;
        eratosthenes(1000000, isPrime);

        lint ans = 0;
        int cnt = 0;
        rep(i, 1000000){
            if(isPrime[i]){
                ans += i;
                ++cnt;
            }
            if(cnt == n){
                break;
            }
        }
        cout << ans << endl;

    }

    return 0;
}


Measured memory_bytes: 3292
#include <iostream>
#include <string>
#include <numeric>
#include <vector>
using namespace std;

#define PAIR pair<int, int>

int lot[30][10];
int n, m, a, d;
int solve(int n) {
	for (int i = 0; i < d; i++) {
		if (lot[i][n] == -1) continue;
		n = lot[i][n];
	}
	return n;
}

int main() {
	string s;
	while (cin >> n) {
		if (n == 0) break;
		cin >> m >> a >> d;

		vector<PAIR> v[30];
		for (int i = 0; i < 30; i++) {
			fill(lot[i], lot[i] + 10, -1);
		}

		for (int i = 0; i < d; i++) {
			cin >> s;
			for (int j = 0; j < n - 1; j++) {
				if (s[j] == '1') {
					lot[i][j] = j + 1;
					lot[i][j + 1] = j;
				}

				if (s[j] == '1') continue;

				if ((j - 1 < 0 || s[j - 1] == '0') && (j + 1 >= n - 1 || s[j + 1] == '0'))
					v[i].push_back(make_pair(j, j + 1));
			}
		}

		m--; a--;
		if (solve(m) == a) {
			cout << 0 << endl;
			continue;
		}

		bool judge = false;
		for (int i = 0; i < d; i++) {
			if (v[i].empty()) continue;
			for (int j = 0; j < v[i].size(); j++) {
				lot[i][v[i][j].first] = v[i][j].second;
				lot[i][v[i][j].second] = v[i][j].first;

				if (solve(m) == a) {
					cout << i + 1 << " " << v[i][j].second << endl;
					judge = true;
					break;
				}

				lot[i][v[i][j].first] = -1;
				lot[i][v[i][j].second] = -1;
			}
			if (judge) break;
		} 
	
		if (!judge) cout << 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3024
#include<bits/stdc++.h>
typedef long long int lli;
using namespace std;
int main(){
    lli n;
    cin>>n;
    lli h[n],i;
    vector<lli> v;
    v.push_back(0);
    for(i=0;i<n;i++){
        cin>>h[i];
    }
    for(i=n-1;i>0;i--){
        if(i==n-1){
            v.push_back(abs(h[i]-h[i-1]));
        }
        else{
            lli temp=min(abs(h[i+1]-h[i-1])+v[v.size()-2],
            abs(h[i]-h[i-1])+v[v.size()-1]);
            v.push_back(temp);
        }
    }
    cout<<v[v.size()-1]<<endl;
}

Measured memory_bytes: 5008
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

namespace A
{
    class Program
    {
        public IEnumerable<string> Solve()
        {
            //var ut = new Util();
            var sc = new Scanner();

            var l = sc.NumLong;
            var r = sc.NumLong;

            var lm = l;
            var rm =
                (r - l) > 4038 ?
                r - ((r - l) / 2019 - 2) * 2019 :
                r;

            var res = long.MaxValue;

            for (long i = lm; i <= rm; i++)
            {
                for (long j = i + 1; j <= rm; j++)
                {
                    long cd = (i * j) % 2019;
                    res = Math.Min(res, cd);
                }
            }

            yield return res.ToString();
        }
    }

    class StartingPoint
    {
        static void Main(string[] args)
        {
            if (args?.Any() == true)
            {
                var assembly = Assembly.GetEntryAssembly();
                var resourceName = "AtCoderCSharp.In.txt";
                var stream = assembly.GetManifestResourceStream(resourceName);
                var streamReader = new StreamReader(stream, Encoding.UTF8);
                var str = streamReader.ReadToEnd();
                var textReader = new StringReader(str);
                Console.SetIn(textReader);
            }

            try
            {
                foreach (var s in new Program().Solve())
                {
                    Console.WriteLine(s);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                if (args?.Any() != true)
                    throw e;
            }

            if (args?.Any() == true)
                Console.ReadKey();
        }
    }

    class Scanner
    {
        public int[] Nums(int count) => Enumerable.Range(0, count).Select(_ => Num).ToArray();
        public int Num => int.Parse(Str);
        public long NumLong => long.Parse(Str);
        public double NumDouble => (double)NumLong;

        StringBuilder sb = new StringBuilder();

        public string Str => GetStr();
        public string GetStr()
        {
            sb.Clear();

            int r = 0;
            bool? b = null;
            do
            {
                r = Console.Read();
                b = IsBreak(r);
            } while (b == true);

            if (b == null)
                throw new Exception("input error: unexpected end of stream");

            do
            {
                sb.Append((char)r);
                r = Console.Read();
                b = IsBreak(r);
            } while (b == false);

            return sb.ToString();
        }

        bool? IsBreak(int c)
        {
            switch (c)
            {
                case -1:
                    return null;
                case (int)' ':
                case (int)'\n':
                case (int)'\r':
                    return true;
                default:
                    return false;
            }
        }
    }
}

Measured memory_bytes: 13268
S = list(input())

ans = True
if ("N" in S) and not("S" in S):
    ans = False
if ("S" in S) and not("N" in S):
    ans = False
if ("W" in S) and not("E" in S):
    ans = False
if ("E" in S) and not("W" in S):
    ans = False

if ans:
    print("Yes")
else:
    print("No")

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

int main() {
  string s,t;
  cin>>s>>t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if(s<t) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().run();
	}
	public void run(){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int count = 0;
			int a = 0;
			int b = 0;
			while(true){
				if(n < 2){
					break;
				}else if(n <= 3){
					count++;
					break;
				}
				a = (int)(0.5 + ((double)n/3.0));
				b = n - (2*a);
				n = Math.max(a,b);
				count++;
			}
			System.out.println(count);
		}
	}
}

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

namespace program
{
    class Program
    {
        static void Main()
        {
          int[] a = Input.ScanIntArray();
          
          Console.WriteLine(a[0]*a[1]%2==0?"Even":"Odd");
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 13268
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int M = sc.nextInt();
		// スペース区切りの整数の入力
		int N = sc.nextInt();
//		int c = sc.nextInt();
	
		// 文字列の入力
//		String s = sc.next();
		// 出力
//		System.out.println((a+b+c) + " " + s);
		
		System.out.println(M*(M-1)/2 + N*(N-1)/2);

	}
}

Measured memory_bytes: 23636
import java.util.Scanner

import scala.collection.Searching._
import scala.annotation.tailrec
import scala.collection.immutable.Queue

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  @tailrec
  private def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {
  def expect(sc: => Scanner): Double = {
    val N = sc.nextInt
    val memo = Array.fill(sc.nextInt)((sc.nextDouble, sc.nextDouble))
    memo.map(A => A._1 * A._2).sum / memo.map(A => A._2).sum
  }

  def solve(sc: => Scanner): Unit = {
    println(if (Array.fill(sc.nextInt)(expect(sc)).max - expect(sc) > 0.00000000001) ("YES") else ("NO"))
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)

    solve(sc)
  }

}

Measured memory_bytes: 61688
N, T = map(int, input().split())
tl = list(map(int, input().split()))

tl.append(float("inf"))

ans = 0

for i in range(N):
    if tl[i]+T>tl[i+1]:
        ans += tl[i+1] - tl[i]
    else:
        ans += T

print(ans)

Measured memory_bytes: 25196
/*
#include <cstdio>
#include <cstring>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
*/
#include <bits/stdc++.h>
#define pb push_back
#define FOR(x,st,n) for(int x = (st); x < (n); ++ x)

using namespace std;


typedef long long unsigned ll;
typedef pair<int,int> P;
//typedef vector<P> vp;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int N = 1e3+1;
ll n,m,k,q;


int Dec(ll x){
    int ret=0;
    while(x){
        x/=10;
        ret++;
    }
    return ret;
}

bool valid(int x){
    int min_dec = INT_MAX;
    for(ll i=1;i*i<=n;i++){
        if(n%i == 0){
            min_dec = min(Dec(n/i),min_dec);
        }
    }
    return min_dec<=x;
}
int find_m(){
    int min_dec = INT_MAX;
    for(ll i=1;i*i<=n;i++){
        if(n%i == 0){
            min_dec = min(Dec(n/i),min_dec);
        }
    }
    return min_dec;
}
int main(){

    cin>>n;
    cout<<find_m()<<endl;

    return 0;
}


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

int main() {
  int n;
  cin>>n;
  vector<int> d(n);
  for(int i=0;i<n;i++){
    cin>>d[i];
  }
  int ans=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      ans+=d[i]*d[j];
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

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

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const long long int INF = 1 << 29; //<10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

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

  ll n,k,s;
	cin >> n >> k >> s;

	vector<ll> a;

	rep(i, n) {
		if(i < k)a.push_back(s);
		else if (s == 1000000000) a.push_back(s-1);
		else a.push_back(s+1);
	}

	rep(i,n) std::cout << a[i] << " ";
}


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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

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

const char newl = '\n';

int main() {
    int n,M = 1024;
    cin >> n;
    // vector<vector<ll>> dp(19,vector<ll>(100010,0));
    vector<int> v(n,0),w(n,1e5);
    for (int i = 0;i < n;++i) cin >> v[i] >> w[i];
    vector<vector<P>> a(n);
    a[0] = {{0,0},{w[0],v[0]}};
    for (int i = 1;i < min(n,M-1);++i) {
        a[i] = a[(i-1)/2];
        for (P j : a[(i-1)/2]) {
            if (j.first+w[i] > 1e5) break;
            a[i].push_back({j.first+w[i],j.second+v[i]});
        }
        sort(a[i].begin(),a[i].end());
        for (int j = 1;j < a[i].size();++j) {
            if (a[i][j-1].first == a[i][j].first) a[i][j-1] = a[i][j];
            else if (a[i][j-1].second > a[i][j].second) a[i][j] = a[i][j-1];
        }
        // sort(a[i].begin(),a[i].end());
        a[i].erase(unique(a[i].begin(),a[i].end()),a[i].end());
    }
    for (int i = M-1;i < min(n,M*2-1);++i) a[i] = {{0,0},{w[i],v[i]}};
    for (int i = M*2-1;i < n;++i) {
        a[i] = a[(i-1)/2];
        for (P j : a[(i-1)/2]) {
            if (j.first+w[i] > 1e5) break;
            a[i].push_back({j.first+w[i],j.second+v[i]});
        }
        sort(a[i].begin(),a[i].end());
        for (int j = 1;j < a[i].size();++j) {
            if (a[i][j-1].first == a[i][j].first) a[i][j-1] = a[i][j];
            else if (a[i][j-1].second > a[i][j].second) a[i][j] = a[i][j-1];
        }
        // sort(a[i].begin(),a[i].end());
        a[i].erase(unique(a[i].begin(),a[i].end()),a[i].end());    
    }
    int q;
    cin >> q;
    while (q--) {
        int b,l;
        cin >> b >> l;
        b--;
        if (b < M-1) {
            cout << prev(upper_bound(a[b].begin(),a[b].end(),P(l,1e9)))->second << newl;
        } else {
            int c = b;
            while (c >= M-1) c = (c-1)/2;
            int j = a[c].size()-1;
            int ans = 0;
            for (int i = 0;i < a[b].size();++i) {
                if (a[b][i].first > l) break;
                while (a[b][i].first+a[c][j].first > l) j--;
                ans = max(ans,a[b][i].second+a[c][j].second);
            }
            cout << ans << newl;
        }
    }
    // for (int i = 0;i < n;++i) p_ary(a[i],0,a[i].size());
}


Measured memory_bytes: 367256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<queue>
#define For(i,j,k)  for(int i=j;i<=k;++i)
#define Dow(i,j,k)  for(int i=k;i>=j;--i)
#define ll long long
#define inf 1e9
#define pb push_back
#define local freopen("in.in","r",stdin);
#define c(x,y)  ((x-1))*m+(y)
using namespace std;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read()
{
	int t=0,f=1;char c=gc();
	while(!isdigit(c))  {if(c=='-') f=-1;c=gc();}
	while(isdigit(c))   t=t*10+c-'0',c=gc();
	return t*f;
}
inline void write(ll x){if(x<0) {putchar('-');write(-x);return;}if(x>=10)    write(x/10);putchar(x%10+'0');}
inline void writeln(ll x){write(x);puts("");}
inline void write_p(ll x){write(x);putchar(' ');}
ll a,b,c,t1,t2,t3,d1,d2,d3,c1,c2,c3;
ll ans;
int main(){
	a=read();b=read();c=read();
	ans=1e9;
	For(i,-100,100)
	{
		t1=max((i-a+1)/2,0ll);
		t2=a+t1*2;t3=t2-i;
		d1=max((i-b+1)/2,0ll);
		d2=b+d1*2;d3=d2-i;
		c1=max((i-c+1)/2,0ll);
		c2=c+c1*2;c3=c2-i;
		ans=min(ans,t1+t3+d1+d3+c1+c3);
	}
	writeln(ans);
}

Measured memory_bytes: 256
use std::collections::BinaryHeap;

fn solve(abs: Vec<(usize, usize)>, m: usize) -> usize {
    let mut m = m;
    let mut abs = abs;

    abs.sort_by_key(|&(a, b)| a);

    let mut ans = 0;

    let mut heap = BinaryHeap::new();

    let mut idx = 0;
    for i in 1..(m + 1) {
        while idx < abs.len() && abs[idx].0 == i {
            heap.push(abs[idx].1);
            idx += 1;
        }

        if let Some(max) = heap.pop() {
            ans += max;
        }
    }

    ans
}

#[test]
fn solve_test() {
    assert_eq!(solve(vec![(4, 3), (4, 1), (2, 2)], 4), 5);
    assert_eq!(solve(vec![(1, 2), (1, 3), (1, 4), (2, 1), (2, 3)], 3), 10);
    assert_eq!(solve(vec![(2, 1)], 1), 0);
}

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let (n, m) = parse_line!(usize, usize);

    let abs = (0..n)
        .map(|_| parse_line!(usize, usize))
        .collect::<Vec<_>>();
    println!("{}", solve(abs, m));
}


Measured memory_bytes: 8444
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }
        int pre = 0;
        while(true){
            Arrays.sort(h);
            if(pre == h[0]) break;
            pre = h[0];
            for(int i = 1; i < n; i++){
                if(h[i] % pre != 0) h[i] = h[i] % pre;
            }
        }
        System.out.println(h[0]);
        sc.close();
    }

}


Measured memory_bytes: 51796
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		String[] s = new String[H];
		System.out.println();
		for(int i = 0; i < H; i++) {
			s[i] = sc.next();
		}
		for(int i = 0; i < W + 2; i++) {
			System.out.print("#");
		}
		System.out.println();
		for(int i = 0; i < H; i++) {
				System.out.print("#");
				System.out.print(s[i]);
				System.out.print("#");
				System.out.println();
		}
		for(int i = 0; i < W + 2; i++) {
			System.out.print("#");
		}
	}

}


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

int main(){
    ll n;
    cin >> n;
    if(n >= 30){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <sstream>
using namespace std;
#include <string>
int main(){
	string s;
	
	int flag1=0;
	int flag2=0;
	cin >>s;
	string mm;
	mm.append(s,0,2);
	string yy;
	yy.append(s,2,2);
	//1 YYMM
 	stringstream ss;
 	int mmtmp,yytmp;
 	ss<< yy;
 	ss>>yytmp;
 	if (yytmp<=12 && yytmp>0){
 		flag1=1;
	 }
 	stringstream ss1;
 	ss1 <<mm;
 	ss1>>yytmp;
 	if (yytmp<=12 && yytmp>0){
 		flag2=1;
	 }
	 
	 
 	
	 
	 if (flag1==1 && flag2==1){
	 	cout << "AMBIGUOUS";
	 }
	 if (flag1==1 && flag2==0){
	 	cout << "YYMM";
	 }
	if (flag1==0 && flag2==1){
	 	cout << "MMYY";
	 }
	if (flag1==0 && flag2==0){
	 	cout << "NA";
	 }
	
	
	
	
	return 0;
} 

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

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T1, class T2>
ostream &operator<<(ostream &s, pair<T1, T2> P)
{
    return s << '<' << P.first << ", " << P.second << '>';
}
template <class T>
ostream &operator<<(ostream &s, vector<T> P)
{
    for (int i = 0; i < P.size(); ++i)
    {
        if (i > 0)
        {
            s << " ";
        }
        s << P[i];
    }
    return s;
}
template <class T>
ostream &operator<<(ostream &s, vector<vector<T>> P)
{
    for (int i = 0; i < P.size(); ++i)
    {
        s << endl
          << P[i];
    }
    return s << endl;
}
template <class T>
ostream &operator<<(ostream &s, set<T> P)
{
    EACH(it, P) { s << "<" << *it << "> "; }
    return s << endl;
}
template <class T1, class T2>
ostream &operator<<(ostream &s, map<T1, T2> P)
{
    EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; }
    return s << endl;
}
template <class T>
void show(vector<T> v)
{
    for (int i = 0; i < v.size(); i++)
    {
        cerr << v[i] << " ";
    }
    cerr << "\n";
}
typedef long long ll;

signed main()
{
    int n;
    cin >> n;
    vector<pair<int, int>> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i].first >> v[i].second;
    }
   // sort(ALL(v));
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++)
    {
        a[i] = v[i].first;
        b[i] = v[i].second;
    }
    sort(ALL(a));
    sort(ALL(b));
  //  double x, y;
    if (n % 2 == 0)
    {
      int   x = (a[(n - 1) / 2] + a[(n - 1) / 2 + 1]) ;
       int  y = (b[(n - 1) / 2] + b[(n - 1) / 2 + 1]);
        cout << y - x + 1 << endl;
    }
    else
    {
        int x = a[n / 2];
        int y = b[n / 2];
    
        cout << y - x + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 9600