akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int p = sc.nextInt();
        int q = sc.nextInt();
        int r = sc.nextInt();
        int max = Math.max(p, q);
        max = Math.max(max, r);
        System.out.println(p + q + r - max);
        sc.close();
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define tam 300000
#define inf 100000000
#define l 'A'

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <ll, ll> dl;
typedef pair <int, int> ii;
typedef vector <ii> vii;
typedef vector <vii> graph;

bool comp(int a, int b) {
	return a > b;
}

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

	int arr[3];
	for (int i = 0; i < 3; ++i)
	{
		cin >> arr[i];
	}
	if ((arr[2] < arr[1] && arr[2] > arr[0]) || (arr[2] < arr[0] && arr[2] > arr[1])) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


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

int main()
{
	int n, x = 0, max = 0;
	cin >> n;
	string s;
	char arr[1000];
	/*s.length() = n;*/
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
		if (arr[i] == 'I')
		{
			x += 1;
			if (x > max)
				max = x;
		}
		else
		{
			x -= 1;
			if (x > max)
				max = x;
		}
	}
	cout << max;
}

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

using namespace std;

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

const int inf = 1e9;
const ll inf64 = 1e18;

vector<int> solve(int n, int k, int s) {
    vector<int> a(n);
    if (s == inf) {
        for (int i = 0; i < n; i++) {
            if (i < k)
                a[i] = inf;
            else
                a[i] = 1;
        }
    } else {
        for (int i = 0; i < n; i++) {
            if (i < k)
                a[i] = s;
            else
                a[i] = inf;
        }
    }
    return a;
}

bool check(int n, int k, int s, const vector<int>& a) {
    for (int i = 0; i < n; i++) {
        if (a[i] < 1 || a[i] > inf)
            return false;
    }
    int cnt = 0;
    for (int l = 0; l < n; l++) {
        ll hlp = 0;
        for (int r = l; r < n; r++) {
            hlp += a[r];
            if (hlp == s)
                cnt++;
        }
    }
    return cnt == k;
}

int main() {

#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, k, s;

    cin >> n >> k >> s;

//    mt19937 rnd(time(NULL));
//    n = rnd() % 1000 + 1;
//    k = rnd() % (n + 1);
//    s = rnd() % inf + 1;

    vector<int> a = solve(n, k, s);

//    assert(check(n, k, s, a));

    for (int x : a) {
        cout << x << " ";
    }
    cout << "\n";

    return 0;
}


Measured memory_bytes: 1792
N = int(input())
SP = []
for i in range(N):
    S,P = input().split()
    P = int(P)
    SP.append([S,P,i+1])
SP.sort(key=lambda x:x[1],reverse=True)
SP.sort(key=lambda x:x[0])
for i in range(N):
    print(SP[i][2])

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;

int main() {
	int n, k;
	double p[200000];
	double ans = 0, pp[200000], ma = 0, lm = 0, mp;
	cin >> n >> k;
	rep(i, n)cin >> p[i];
	rep(i, n)pp[i] = (p[i] + 1) / 2;
	rep(j, k)lm = lm + pp[ j];
	ma = max(ma, lm);
	REP(i,1, n - k+1) {
		lm = lm+ pp[i-1+k] - pp[i - 1] ;
		if (ma < lm) {
			ma = lm;
		}
	}
	cout <<fixed<<setprecision(10)<< ma << endl;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  
  string prev = "",
    cur = "",
    next = "";
  cin >> cur >> next;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      char c = cur.at(j);
      
      if (c == '#') {
        cout << c;
        continue;
      }

      int n_bomb = 0;

      if (j != 0 && cur.at(j - 1) == '#') n_bomb++;
      if (j != w - 1 && cur.at(j + 1) == '#') n_bomb++;
      
      if (prev != "" && j != 0 && prev.at(j - 1) == '#') n_bomb++;
      if (prev != "" && prev.at(j) == '#') n_bomb++;
      if (prev != "" && j != w - 1 && prev.at(j + 1) == '#') n_bomb++;

      if (next != "" && j != 0 && next.at(j - 1) == '#') n_bomb++;
      if (next != "" && next.at(j) == '#') n_bomb++;
      if (next != "" && j != w - 1 && next.at(j + 1) == '#') n_bomb++;
      
      cout << n_bomb; 
    } 
    cout << endl;

    prev = cur;
    cur = next;
    if (i < h - 2) {
      cin >> next;
    } else {
      next = "";
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"
template<class T> void chmax(T &a, const T b){ a = max(a, b); }
template<class T> void chmin(T &a, const T b){ a = min(a, b); }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, z, w;
    cin >> n >> z >> w;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    if (n == 1) {
        cout << abs(a[0] - w) << endl;
    }
    else {
        cout << max(abs(a[n - 1] - w), abs(a[n - 2] - a[n - 1])) << endl;
    }
    return 0;
}


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

typedef long long ll;
const int N = 306;
const ll mod = 998244353;
typedef bitset<N> bst;

bst a[N],b[N],empty;

int n,m;

int cal() {
    int ret = 0;
    for (int i = 0; i < n; ++i)
        for (int j = m; j >= 0; --j)
            if (a[i][j]) {
                if (b[j] != empty) a[i] ^= b[j];
                else {
                    ++ret;
                    b[j] = a[i];
                    for (int k = j - 1; k >= 0; --k) if (b[k] != empty && (b[j][k])) b[j] ^= b[k];
                    for (int k = j + 1; k <= m; ++k) if (b[k][j]) b[k] ^= b[j];
                    break;
                }
            }
    return ret;
}

ll ppow(ll a,ll n) {
    ll ret=1,now=a;
    while (n) {
        if (n&1) {
            ret *= now;
            ret %= mod;
        }
        now *= now;
        now %= mod;
        n >>= 1;
    }
    return ret;
}

ll rev(ll x) {
    return ppow(x,mod-2);
}

int main () {
    //int n,m;
    cin >> n >> m;
    for (int i=0;i<n;++i) {
        for (int j=0;j<m;++j) {
            int x;
            cin >> x;
            a[i][j] = x;
        }
    }
    int x = cal();
    //cout << "x = " << x << endl;
    ll all_zero = ppow(2,n-x);
    //cout << "all_zero = " << all_zero << endl;
    ll ans = ppow(2,n+m);
    //cout << " ans = " << ans << endl;
    ans -= all_zero * ppow(2,m);
    //cout << "ans = " << ans << endl;
    ans = (ans%mod+mod)%mod;
    cout << ans * rev(2) % mod << endl;
}


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

int main() {
  int m1,d1,m2,d2;
  cin >> m1 >> d1;
  cin >> m2 >> d2;

  if (m1 != m2 && d1 > d2) {
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>

constexpr int MOD = 10007;

void solve() {
    int n;
    std::cin >> n;

    std::vector<int> dp(8, 0);
    dp[1] = 1;
    auto ndp = dp;
    while (n--) {
        int i = 0;
        {
            char c;
            std::cin >> c;
            while (c != "JOI"[i]) ++i;
        }

        std::fill(ndp.begin(), ndp.end(), 0);
        for (int pb = 0; pb < 8; ++pb) {
            for (int b = 0; b < 8; ++b) {
                if ((pb & b) == 0 || ((b >> i) & 1) == 0) continue;
                (ndp[b] += dp[pb]) %= MOD;
            }
        }

        std::swap(dp, ndp);
    }

    std::cout << std::accumulate(dp.begin(), dp.end(), 0) % MOD << "\n";
}

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

    solve();

    return 0;
}



Measured memory_bytes: 3180
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    long long int N,H,W,i,j,k,ans,count,cost,tmp;
    long long int S[200010];
    long long int Ssum[200010];
    string T;
    bool flag;
    count=0;
    ans=std::pow(10,18);
    flag=false;
    cin >>N>>H;
    
        if (N>2*H){
            cout <<N-2*H <<endl;
        }
        else{
            cout <<0 <<endl;
        }
    

    
    

    return 0;
    
}


Measured memory_bytes: 3524
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
a, b = map(int, input().split())
x = make_divisors(a)
y = make_divisors(b)
z = set(x) & set(y)
cnt = 1
for i in z:
    if is_prime(i):
        cnt = cnt + 1
print(cnt)

Measured memory_bytes: 5264
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int n;
    cin >> n;
    cout << "ABC" << n << endl;
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {

    if (num == 1) {
        return;
    }
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }
    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }

        return;
    }
    prime_map(m, num);
    return;
}


Measured memory_bytes: 256
import math
from collections import deque
from collections import defaultdict

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

h = readInt()

ans=0
count = 0
while h!=1:
	h=h//2
	count+=1

print(2**(count+1)-1)

Measured memory_bytes: 3444
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
//#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(){
    long int N,M;
    cin>>N>>M;
    vector<long int> A(M),B(M);
    vector<vector<long int> > fri(N);
    for (long int i=0;i<M;i++){
        cin>>A[i]>>B[i]; 
        A[i]--;
        B[i]--;
        fri[A[i]].push_back(B[i]);
        fri[B[i]].push_back(A[i]);
    }
    vector<bool> flag(N,true);
    long int ans=0; 
    for (long int i=0;i<N;i++){
        if (!flag[i]) continue;
        queue<long int> que;
        que.push(i);
        flag[i]=0;
        long int n=1;
        while (!que.empty()){
            long int x=que.front();
            //cout<<x;
            que.pop();
            long int sz=fri[x].size();
            for (long int j=0;j<sz;j++){
                if (!flag[fri[x][j]]) continue;
                flag[fri[x][j]]=false;
                n++;
                que.push(fri[x][j]);
            }
        }
        //cout<<n<<endl;
        if (ans<n) ans=n;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 20044
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
vi v2, v3, v6;

void solve() {
	cin >> N;
	if(N == 3) {
		cout << "2 5 63\n";
	}
	else {
		N -= 4;
		cout << "2 4 3 9 ";
		v6.pb(6);
		v2.pb(8);
		v2.pb(10);
		v6.pb(12);
		for(int i = 13; i <= 30000; i++) {
			if(i % 6 == 0) v6.pb(i);
			else if(i % 3 == 0) v3.pb(i);
			else if(i % 2 == 0) v2.pb(i);
		}
		int x, y, z;
		z = min(N, sz(v6) - N % 2);
		N -= z;
		x = min(N, sz(v2));
		N -= x;
		y = N;
		rep(i, 0, x) cout << v2[i] << " ";
		rep(i, 0, y) cout << v3[i] << " ";
		rep(i, 0, z) cout << v6[i] << " ";
		cout << "\n";
	}
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 512
import java.util.*;
import java.util.stream.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        boolean[] b = new boolean[n];
        String s = scanner.next();
        IntStream.range(0, n).forEach(i -> b[i] = s.charAt(i) == '#');
        int[] c = new int[n + 1];
        for (int i = 0; i < n; i++)
            c[i + 1] = c[i] + (s.charAt(i) == '#' ? 1 : 0);

        int ans = Integer.MAX_VALUE;
        for (int i = 0; i <= n; i++) {
            int bb = c[i];          //前の黒
            int bw = i - bb;        //前の白
            int ab = c[n] - bb;     //後の黒
            int aw = n - c[n] - bw; //後の白

            ans = Math.min(ans, bb + aw);
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 31208
N = int(input())
H = list(map(int,input().split()))


ans = 0
pre = -1
tmp = 0
for i in range(N-1, -1, -1):
    h = H[i]
    if i != N-1:
        if pre > h:
            tmp = 0
        else:
            tmp += 1
            if tmp > ans:
                ans = tmp
    pre = h

print(ans)

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

#define int long long
#define counter(m)     for(int i=0;i<m;i++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    int n,x;
    cin>>n>>x;
    vector<int>v(n);
    for(auto &c:v) cin>>c;
    sort(v.begin(),v.end());
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        if(x>=v[i])
        {
            x-=v[i];
            cnt++;
        }
        else{
            break;
        }
    }
    if(cnt==n && x!=0)
        cout<<n-1<<endl;
    else
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 3556
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			if (n==0) {
				break;
			}
			boolean[][] map = new boolean[n][n];
			for(int i=0;i<n;i++) {
				int m = sc.nextInt();
				for(int j=0;j<m;j++) {
					int p = sc.nextInt()-1;
					map[i][p] = true;
				}
			}
			boolean[] bad = new boolean[n];
			int k = sc.nextInt();
			for(int i=0;i<k;i++) {
				int l = sc.nextInt()-1;
				for(int j=0;j<n;j++) {
					if (!map[j][l]) {
						bad[j] = true;
					}
				}
			}
			int ans = -1;
			for(int i=0;i<n;i++) {
				if (!bad[i]) {
					if (ans == -1) {
						ans = i+1;
					}else{
						ans = -1;
						break;
					}
				}
			}
			System.out.println(ans);
		}
	}

}

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

int main(){

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

  if(a==1){
    cout << b << endl;
  }else{
    for(int i=b-a+1;i<b+a-1;i++){
      cout << i << " ";
    }
    cout << b+a-1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 36

typedef struct{
  char kind;
  int num;
}Card;

void bubblesort(Card * ,int);
void selectionsort(Card *,int);
//void swap(Card *,Card *);
int isStable(Card *,Card *,int n);

int main(){
  int n;
  int i;
  Card card1[N],card2[N];
  int flag=0;
  
  scanf("%d",&n);//枚数の入力
  for(i=0;i<n;i++){
    scanf(" %c%d",&card1[i].kind,&card1[i].num);
    card2[i]=card1[i];
  }
  
  
  bubblesort(card1,n);
  for(i=0;i<n-1;i++){
    printf("%c%d ",card1[i].kind,card1[i].num);
  }
  printf("%c%d\n",card1[n-1].kind,card1[n-1].num);
  printf("Stable\n");
  
  selectionsort(card2,n);
  for(i=0;i<n-1;i++){
    printf("%c%d ",card2[i].kind,card2[i].num);
  }
  printf("%c%d\n",card2[n-1].kind,card2[n-1].num);
  for(i=0;i<n;i++){
    flag=flag+isStable(card1,card2,n);
  }
  if(flag==0)printf("Not stable\n");
  else printf("Stable\n");
  return 0;
}

void bubblesort(Card A[],int n){
  int i,j;
  Card temp;
  for(i=0;i<=n-1;i++){
    for(j=n-1;j>=i+1;j--){
      if(A[j].num<A[j-1].num){
	//swap(&A[j],&A[j-1]);
	temp=A[j];
	A[j]=A[j-1];
	A[j-1]=temp;
      }
    }
  }
  
}

void selectionsort(Card A[],int n){
  int i,j,minj;
  Card temp;
  for(i=0;i<=n-1;i++){
    minj=i;
    for(j=i;j<=n-1;j++){
      if(A[j].num<A[minj].num)
	minj=j;
      }
    
   
   
      temp=A[i];
      A[i]=A[minj];
      A[minj]=temp;
    }
  
}
 
/*void swap(Card *a,Card *b){
  Card temp;
  temp=*a;
  *a=*b;
  *b=temp;
  }*/

int isStable(Card *a,Card *b,int n){
  int i;

  for(i=0;i<n;i++){
    if(a[i].kind!=b[i].kind) 
    return 0;
  }
  return 1;
}



Measured memory_bytes: 2736
#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
#define lli long long int
int main(){
  lli i,j,n,sum=0;
  cin>>n;
  lli a[n+1],b[n];
  for(i=0;i<n+1;i++){
    cin>>a[i];
  }
  for(i=0;i<n;i++)
    cin>>b[i];
  for(i=0;i<n;i++){
    if(b[i]>=a[i]){
      sum=sum+a[i];
      if(b[i]-a[i]>0 && (a[i+1]>0)){
        if(b[i]-a[i]>a[i+1]){
          sum=sum+a[i+1];
          a[i+1]=0;
        }
        else{
          sum=sum+b[i]-a[i];
          a[i+1]=a[i+1]-(b[i]-a[i]);
        }
      }
    }
    else{
      sum=sum+b[i];
    }
  }
  cout<<sum;
  return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		while(true){
			String[] tmpArray = br.readLine().split(" ");
			
			int w = Integer.parseInt(tmpArray[0]);
			int h = Integer.parseInt(tmpArray[1]);
			
			if(w == 0 && h == 0){
				break;
			}
			
			int matrix[][] = new int[h][w];
			
			for(int i = 0; i < h; i++){
				tmpArray = br.readLine().split(" ");
				for(int j = 0; j < w; j++){
					matrix[i][j] = Integer.parseInt(tmpArray[j]);
				}
			}
			
			visited = new boolean[h][w];
			
			int island = 0;
			
			for(int i = 0; i < h; i++){
				for(int j = 0; j < w; j++){
					if(matrix[i][j] == 1 && !visited[i][j]){
						dfsWithStack(matrix, j, i, 1);
						island++;
					}
				}
			}
			
			System.out.println(island);
		}
	}
	
	static boolean[][] visited;
	static int[] dx = {0,1,1,1,0,-1,-1,-1};
	static int[] dy = {1,1,0,-1,-1,-1,0,1};
	
	static void dfsWithStack(int[][] matrix, int x, int y, int type){
        int h = matrix.length;
        int w = matrix[0].length;
 
        Stack<Point> stack = new Stack<Point>();
 
        visited[y][x] = true;
//    	System.out.println("start x "+x+ " y "+ y);
        
    	stack.add(new Point(x, y));
 
        while(!stack.isEmpty()){
            Point p = stack.pop();
 
//          visited[p.y][p.x] = true;
            //???
            for(int i = 0; i < 8; i++){
            	int x2 = p.x + dx[i];
            	int y2 = p.y + dy[i];
            	
            	
            	if(x2 >= 0 && x2 < w && y2 >= 0 && y2 < h && matrix[y2][x2] == type && !visited[y2][x2]){
//            		System.out.println("push x2 "+x2+ " y2 "+ y2);
                	
            		stack.push(new Point(x2, y2));
            		visited[y2][x2] = true;
            	}
            }
//            
//            if(p.x > 0 && matrix[p.y][p.x - 1] == type && !visited[p.y][p.x - 1]){
//                stack.push(new Point(p.x-1, p.y));
//                visited[p.y][p.x-1] = true;
//            }
// 
//            //???
//            if(p.y < h - 1 && matrix[p.y+1][p.x] == type && !visited[p.y+1][p.x]){
//                stack.push(new Point(p.x, p.y+1));
//                visited[p.y+1][p.x] = true;
//            }
// 
//            //???
//            if(p.x < w - 1 && matrix[p.y][p.x + 1] == type && !visited[p.y][p.x + 1]){
//                stack.push(new Point(p.x+1, p.y));
//                visited[p.y][p.x+1] = true;
//            }
// 
//            //???
//            if(p.y > 0 && matrix[p.y-1][p.x] == type && !visited[p.y-1][p.x]){
//                stack.push(new Point(p.x, p.y-1));
//                visited[p.y-1][p.x] = true;
//            }
// 
        }
    }
}
 
class Point{
    int x; int y;
 
    public Point(int x, int y){
        this.x = x;
        this.y = y;
    }
}

Measured memory_bytes: 28996
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  int ans = 0;
  for(int i=0;i<s.size();i++){
    int cnt = 0;
    for(int j=i;j<s.size();j++){
      if(s[j]=='A' || s[j]=='C' || s[j]=='G' || s[j]=='T'){
        cnt++;
      }else{
        break;
      }
    }
    ans = max(ans,cnt);
  }
  cout << ans << endl;
}


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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template <typename T>
inline void chkmax(T &x, T y) { if (x < y) x = y; }

template <typename T>
inline void chkmin(T &x, T y) { if (x > y) x = y; }

inline int read() {
  #define nc getchar()
  int x = 0;
  char c = nc;
  while (c < 48) c = nc;
  while (c > 47) x = x * 10 + (c ^ 48), c = nc;
  return x;
  #undef nc
}

const int P = 1e9 + 7;

int Inc(int x, int y) {
  return x + y < P ? x + y : x + y - P;
}

int Dec(int x, int y) {
  return x < y ? x - y + P : x - y;
}

void Add(int &x, int y) {
  x += y;
  if (x >= P) x -= P;
}

void Sub(int &x, int y) {
  x -= y;
  if (x < 0) x += P;
}

int qp(int a, int k) {
  int res = 1;
  for (; k; k >>= 1, a = 1ll * a * a % P) {
    if (k & 1) res = 1ll * res * a % P;
  }
  return res;
}

typedef long long ll;
const int maxn = 1 << 18 | 5;
int H, n, A[maxn];

//int sum[maxn];
//int prod[maxn], invp[maxn];

//void dfs(int u, int dep) {
//  prod[u] = 1ll * u * prod[u >> 1] % P, invp[u] = qp(prod[u], P - 2);
//  if (dep == H) sum[u] = prod[u];
//  if (dep < H) dfs(u << 1, dep + 1), dfs(u << 1 | 1, dep + 1), sum[u] = Inc(sum[u << 1], sum[u << 1 | 1]);
//}

int ans;
int T, sub[maxn], tim[maxn];

void dfs1(int u, int val) {
  if (u * 2 > n + n - 1) {
    int pos = n + A[u - n + 1] - 1;
    while (pos) {
      if (tim[pos] != T) {
        tim[pos] = T, sub[pos] = 0;
      }
      val = 1ll * val * pos % P;
      Add(sub[pos], val);
      pos >>= 1;
//      printf("#%d %d\n", pos, val);
    }
    return;
  }
  dfs1(u << 1, 1ll * (u << 1) * val % P), dfs1(u << 1 | 1, 1ll * (u << 1 | 1) * val % P);
}

void dfs2(int u, int val) {
  if (u * 2 > n + n - 1) {
//    printf("#%d\n", u);
    int pos = n + A[u - n + 1] - 1;
//      printf("#%d\n",pos);
    while (pos) {
      if (tim[pos ^ 1] != T) {
        tim[pos ^ 1] = T, sub[pos ^ 1] = 0;
      }
//      printf("#%d %d\n", pos, val);
      val = 1ll * val * pos % P;
      ans = (ans + 1ll * sub[pos ^ 1] * val % P * (pos >> 1)) % P;
      pos >>= 1;
    }
    return;
  }
  dfs2(u << 1, 1ll * (u << 1) * val % P), dfs2(u << 1 | 1, 1ll * (u << 1 | 1) * val % P);
}

void solve() {
  cin >> H;
  n = 1 << (H - 1);
  rep(i, 1, n) A[i] = read();
//  prod[0] = 1, invp[0] = 1;
//  dfs(1, 1);
  rep(anc, 1, n - 1) {
    T = anc;
    int lef = anc << 1, rig = anc << 1 | 1;
    dfs1(lef, 1ll * anc * lef % P);
    dfs2(rig, rig);
  }
  cout << ans << endl;
}

int main() {
//  int T = read();
//  while (T--) solve();
  solve();
  return 0;
}

Measured memory_bytes: 6136
#include<iostream>
using namespace std;
int main(){
    int x,y,n,c;
    cin>>x>>y;
    if(x>y){
        n=x%y;
        while(1){
            c=y%n;
            if(c==0||n==1) break;
            y=n;
            n=c;
        }
        if(n==1) cout<<n<<endl;
        else cout<<n<<endl;
    }
    else if(x==y){
        cout<<y<<endl;
    }
    else{
        n=y%x;
        while(1){
            c=x%n;
            if(c==0||n==1) break;
            x=n;
            n=c;        
    }
        if(n==1) cout<<n<<endl;
        else cout<<n<<endl;
    }
}


Measured memory_bytes: 3116
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <string>
using namespace std;
const int maxn = 1e3;
long long ch[87];
int main()
{
    ch[0] = 2;
    ch[1] = 1;
    for(int i = 2;i < 87;i++)
        ch[i] = ch[i-1]+ch[i-2];
    int n;
    while(cin >> n)
    {
        cout << ch[n] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define sz(x) int(x.size())
using ll = long long;
using P = pair<int,int>;
const ll LLINF = numeric_limits<long long>::max();
const int mod = 1000000007;
const int INF = 1001001001;

int main()
{
    
    ll N;
    cin >> N;
    string s="";
    while(!N==0){
        int mod = N%26;
        if(mod==0){
            s += 'z';
          	N -= 1;
        }
        else{
            s += ('a'-1+mod);
          
        }
        N /=26;
    }
    reverse(s.begin(), s.end());
    cout << s;
   
}

Measured memory_bytes: 3572
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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;}

using ll = long long;
using Graph = vector<vector<int>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN3(n,a,b);
  Vi X(n);
  VIN(X)
  int ans = 0;
  REP(i,n-1) {
    ans += min((X[i+1]-X[i])*a, b);
  }
  OUT(ans);
}

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

template <typename T>
inline T read(){
	T x=0,f=1;char c=getchar();
	while(!isdigit(c)){	if(c=='-') f=-f;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+(c-48);c=getchar();}
	return x*f;
}

#define lint long long int
#define ulint unsigned lint
#define readint read<int>()
#define readlint read<lint>()
const int inf=1e9+1e7,MAXN=2e5+1e1;
const lint INF=1e18+1e9;

struct Node{
	lint r,b;
}a[MAXN];

lint Ans=INF,maxn,minn=inf;
bool vis[MAXN],vmax,vmin;
int n;

bool Cmpr(Node A,Node B){
	return (A.r==B.r ? A.b<B.b : A.r<B.r);
}

bool Cmpb(Node A,Node B){
	return (A.b==B.b ? A.r<B.r : A.b<B.b);
}

void Solve1(){
	lint maxm=maxn,minm=minn;
	for(int i=1;i<=n;i++) maxm=min(a[i].b,maxm),minm=max(a[i].r,minm);
	Ans=min((minm-minn)*(maxn-maxm),Ans);
	return;
}

void Solve2(){
	lint maxm=max(a[n].r,a[1].b),minm=min(a[n].r,a[1].b),tmp=INF;
	for(int i=2;i<n;i++) if(a[i].b<minm) minm=a[i].b,vis[i]=true;
	for(int i=2;i<n;i++) if(a[i].r>maxm) maxm=a[i].r,vis[i]=true;
	for(int i=2;i<n;i++) if(minm<=a[i].b && a[i].b<=maxm) vis[i]=true;
	for(int i=2;i<n;i++) if(minm<=a[i].r && a[i].r<=maxm) vis[i]=true;
	for(int i=2;i<n;i++) if(!vis[i]){
		tmp=min(maxm-min(a[i].r,minm),tmp),maxm=max(a[i].b,maxm);
	}
	if(tmp<INF) Ans=min((maxn-minn)*tmp,Ans);
	else Ans=min((maxn-minn)*(maxm-minm),Ans);
	return;
}

int main(void){

	// freopen("testdata.in","r",stdin);
	// freopen("testdata.out","w",stdout);

	scanf("%d",&n);
	for(int i=1;i<=n;i++) a[i].r=readint,a[i].b=readint;
	for(int i=1;i<=n;i++) if(a[i].r>a[i].b) swap(a[i].r,a[i].b);
	sort(a+1,a+n+1,Cmpb),maxn=a[n].b,vmax=(a[n].b==a[n-1].b);
	sort(a+1,a+n+1,Cmpr),minn=a[1].r,vmin=(a[1].r==a[2].r);
	sort(a+1,a+n+1,Cmpb),sort(a+1,a+n,Cmpr);
	if(vmax || vmin || minn!=a[n].r || maxn!=a[n].b){
		minn=a[1].r,maxn=a[n].b;
	}
	Solve1(),Solve2(),printf("%lld\n",Ans);

	return 0;
}

Measured memory_bytes: 7148
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> p;
    for(int i=0; i<N; i++)
    {
    	int x;
    	cin >> x;
    	p.push_back(x);
    }
    int max_price = *max_element(p.begin(),p.end());
    int sum = accumulate(p.begin(),p.end(),0);
    cout << sum - max_price/2 << endl;
	return 0;
}

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

int main()
{
	int n;
	
	std::cin >> n;
	std::vector<std::string>answer;
	for(int i = 0;i < n;i++)
	{
		std::vector<int>length(3);
		for(int i = 0;i < 3;i++)
		{
			std::cin >> length[i]; 
		}
		std::sort(length.begin(),length.end());
		if((length[0]*length[0]) + (length[1]*length[1]) == (length[2]*length[2]))
		{
			answer.push_back("YES");
		}
		else
		{
			answer.push_back("NO");	
		}
	}

	for(int i = 0;i < n;i++)
	{
		std::cout << answer[i] << std::endl;
	}

	return 0;
}

Measured memory_bytes: 0
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st =  new StringTokenizer(br.readLine());
		int n=Integer.parseInt(st.nextToken()), w=Integer.parseInt(st.nextToken()), tot=0;
		long[]ws=new long[n];
		int[]vs=new int[n];
		for(int i=0;i<n;i++){
			st=new StringTokenizer(br.readLine());
			ws[i]=Long.parseLong(st.nextToken());
			vs[i]=Integer.parseInt(st.nextToken());
			tot+=vs[i];
		}
		long[][]dp=new long[n][tot+1];
		for(int i=0;i<n;i++)Arrays.fill(dp[i], -1);
		dp[0][vs[0]]=ws[0];
		dp[0][0]=0;
		for(int i=1;i<n;i++){
			for(int j=0;j<=tot;j++){
				dp[i][j]=dp[i-1][j];
				if(j-vs[i]>-1&&dp[i-1][j-vs[i]]!=-1){
					if(dp[i][j]==-1)dp[i][j]=ws[i]+dp[i-1][j-vs[i]];
					else dp[i][j]=Math.min(dp[i][j], ws[i]+dp[i-1][j-vs[i]]);
				}
			}
		}
		for(int i=tot;i>=0;i--){
			for(int j=0;j<n;j++){
				if(dp[j][i]<=w&&dp[j][i]!=-1){
					System.out.println(i);
					return;
				}
			}
		}
	}
}

Measured memory_bytes: 126932
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

#define for1(n) for (int i = 0 ; i < n ; i++)
#define for2(n) for (int j = 0 ; j < n ; j++)
#define for1l(n) for (ll i = 0 ; i < n ; i++)
#define for2l(n) for (ll j = 0 ; j < n ; j++)

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int x[n], y[n], h[n];
    for1(n) cin >> x[i] >> y[i] >> h[i];
    for1(n) if (h[i]) swap(x[0], x[i]), swap(y[0], y[i]), swap(h[0], h[i]);
    for (int i = 0 ; i <= 100 ; i++) {
        for (int j = 0 ; j <= 100 ; j++) {
            int a = abs(i - x[0]) + abs(j - y[0]) + h[0];
            bool w = 0;
            for (int k = 1 ; k < n ; k++) {
                if (max(0, a - abs(i - x[k]) - abs(j - y[k])) != h[k]) w = 1;
            }
            if (w == 0) {
                cout << i << ' ' << j << ' ' << a;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3596
fn main() {
    let s = {
        let mut s = String::new(); 
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_string()
    };

    let mut tokens = s.split(" ")
        .map(|num| num.parse().unwrap())
        .collect::<Vec<i32>>();

    let cp_tokens = tokens.clone();
    tokens.sort();

    if cp_tokens == tokens {
        tokens.dedup();
        if tokens.len() == cp_tokens.len() {
            println!("Yes");
            return;
        }
    } 

    println!("No");
}



Measured memory_bytes: 5020
#include <stdio.h>

int main(void){
  
  int n, l, i, m, o;
	int sum = 0;
	int array[210];

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

	for (m = 1; m <= n; m++) {
		array[m] = l + m - 1;
	}

	if (l >= 0) {
		array[1] = 0;
		for (m = 1; m <= n; m++) {
			sum += array[m];
		}
		printf("%d\n", sum);
	}

	if (l <= -n ) {
		
		array[n] = 0;
		for (m = 1; m <= n; m++) {
			sum += array[m];
		}
		printf("%d\n", sum);
	}

	//この条件では必ず0が含まれる。

	if (-n < l&&l < 0) {
		for (m = 1; m <= n; m++) {
			sum += array[m];
		}
		printf("%d\n", sum);
	}
  
  return 0;
}


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

using namespace std;

long double const PI = (acos(-1));
 
int main(){
	long double a, b, x;
	cin >> a >> b >> x;
	long double res;

	if(a * a * b / 2.0 <= x){
		res = atan(2 * (a * a * b - x) / (a * a * a));
	}
	else{
		res = PI / 2 - atan(2 * x / (a * b * b));
	}

	res = res * 180 / PI;
	cout << fixed << setprecision(10) << res << endl;
}

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

int main(){
    string S;
    cin >> S;
    int k=S.length();
    int maru=0;
    for (int i=0; i<k; i++){
        string s = S.substr(i,1);
        if(s == "o") maru++;
    }
    if(15-k+maru >= 8)cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int main(){
    string S; cin >> S;
    int N = (int)S.size();
    for(int bit=0;bit<(1<<N); bit++){
        int result = S[0]-'0';
        for(int j=0;j<N-1;j++){
            if(bit & (1<<j)){
                result += S[j+1]-'0';
            }else{
                result -= S[j+1]-'0';
            }
        }
        if(result == 7){
            string ans="";
            ans += S[0];
            for(int j=0;j<N-1;j++){
                if(bit & (1<<j)){
                    ans += '+';
                }else{
                    ans += '-';
                }
                ans += S[j+1];
            }
            ans += "=7";
            cout << ans << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
#include <numeric>
#include<math.h>
#include <bits/stdc++.h>
using namespace std;

int main(void) {
    char a,b;
    cin>>a>>b;
    if(a==b&&a=='H')cout<<a<<endl;
    if(a=='D'&&b=='H')cout<<a<<endl;
    if(a=='H'&&b=='D')cout<<b<<endl;
    if(a==b&&a=='D')cout<<"H"<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader

fun main() {
    val br = System.`in`.bufferedReader()
    val n = br.readInt()
    val m = br.readInt()
    val k = br.readInt()
    var sum = 0L
    val a = LongArray(n + 1) {
        if (it == 0) {
            0L
        } else {
            sum += br.readInt().toLong()
            sum
        }
    }
    sum = 0L
    val b = LongArray(m + 1) {
        if (it == 0) {
            0L
        } else {
            sum += br.readInt().toLong()
            sum
        }
    }
    var best = 0
    var bPtr = 0
    for (x in n downTo 0) {
        while (bPtr <= m && a[x] + b[bPtr] <= k) {
            best = best.coerceAtLeast(x + bPtr)
            bPtr++
        }
    }
    print(best)
}

private const val SPACE_INT = ' '.toInt()
private const val ZERO_INT = '0'.toInt()
private const val NL_INT = '\n'.toInt()

private fun BufferedReader.readInt(): Int {
    var ret = read()
    while (ret <= SPACE_INT) {
        ret = read()
    }
    val neg = ret == '-'.toInt()
    if (neg) {
        ret = read()
    }
    ret -= ZERO_INT
    var read = read()
    while (read >= ZERO_INT) {
        ret *= 10
        ret += read - ZERO_INT
        read = read()
    }

    while (read <= SPACE_INT && read != -1 && read != NL_INT) {
        mark(1)
        read = read()
    }
    if (read > SPACE_INT) {
        reset()
    }
    return if (neg) -ret else ret
}

Measured memory_bytes: 42100
;; #!/usr/bin/env sbcl --script

(declaim (optimize (speed 3) (safety 0) (debug 0)))

(deftype int32 () '(signed-byte 32))

(defun main ()
  (let* ((n (read))
         (k (read))
         (a (make-array n :element-type 'int32))
         (dp (make-array n :element-type 'int32 :initial-element (+ (expt 10 9) 100))))
    (let ((stream (make-string-input-stream (read-line))))
      (loop for i from 0
         for j = (read stream nil) until (null j)
         do (setf (aref a i) (the int32 j))))
    (setf (aref dp 0) 0)
    (loop for i of-type int32 from 0 below n do
      (loop with from-val of-type int32 = (aref dp i)
         for j of-type int32 from (1+ i) to (+ i k)
         while (< j n)
         do
           (let ((nval (the int32 (+ from-val (abs (- (aref a i) (aref a j)))))))
             (setf (aref dp j) (min (aref dp j) nval)))))
    (format t "~a~%" (aref dp (- n 1)))))

(main)


Measured memory_bytes: 57824
#include<bits/stdc++.h>
using namespace std;
int main()
{	
int n;
cin>>n;
int h[n];
for(int i=0;i<n;++i)
cin>>h[i];
int dp[n]; 
dp[0]=0;
dp[1]=abs(h[1]-h[0]);
for(int i=2;i<n;++i)
 dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]));
cout<<dp[n-1];	
	
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N;
	cin >> N;
	int a[N];
	rep(i, N) cin >> a[i];
	int ans = 0;
	rep(i, N - 1) {
		if (a[i] == a[i + 1]) {
			a[i + 1] = 100000 + i;
			ans++;
		}
	}
	cout << ans << endl;

    return 0;
}


Measured memory_bytes: 892
n = int(input())
a_list = list(map(int, input().split()))
result = [0]
for i in range(n - 1):
    if a_list[i] + result[i] > a_list[i + 1]:
        result.append(a_list[i] + result[i] - a_list[i + 1])
    else:
        result.append(0)
print(sum(result))

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

int gcd(int m,int n){
  while(m != n){
    if (m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}

int main(){
  //ツ素ツ青板青カツ青ャ
  const int NUM = 1000000;
  bool prime[NUM];
  prime[0] = false;
  prime[1] = false;
  for(int i=2;i<NUM;i++)
    prime[i] = true;
  for(int i=2;i*i<NUM;i++)
    for(int k=2;i*k<NUM;k++)
      prime[i*k]=false;

  while(true){
    int n,x;
    cin>>n>>x;
    if(!n&&!x)break;
    int menu[n];
    int g;
    cin>>menu[0];
    g = menu[0];
    for(int i=1;i<n;i++){
      cin>>menu[i];
      g = gcd(g,menu[i]);
    }
    int p = -1;
    if(g==1){
    bool money[x+1];
    money[0] = true;
    for(int i=1;i<x+1;i++){
      money[i] = false;
      for(int j=0;j<n;j++){
	if(i>=menu[j]&&money[i-menu[j]]){
	  money[i] = true;
	  break;
	}
      }
      if(money[i]&&prime[i])p=i;
    }
    }
    if(p==-1)cout<<"NA"<<endl;
    else cout<<p<<endl;
  }
  return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main(){
    int n;
    cin>>n;
    vector<int> a(n),cnt(n);
    rep(i,0,n) cin>>a[i];
    sort(a.begin(),a.end());
    rep(i,0,n){
        while(a[i]%2==0) {
            cnt[i]++;
            a[i]/=2;
        }
    }
    cout<<*min_element(cnt.begin(),cnt.end());
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, n) for(int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
#define riverse(v) reverse((v).begin(), (v).end())
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vll = vector<ll>;
const int MOD = 1e9+7;
vi alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m',
               'n','o','p','q','r','s','t','u','v','w','x','y','z'};
 
int main() {
	ll A,B;
  	cin >> A >> B;
  	if((A+B)%2 == 0)cout << (A+B)/2 << endl;
  	else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
from collections import deque

h, w = map(int, input().split())
a = [input() for _ in range(h)]
r = 0
for i in range(h):
  for j in range(w):
    if a[i][j] == '.':
      b = list(map(list, a))
      q = deque()
      b[i][j] = 0
      q.append((i, j))
      while(q):
        i, j = q.popleft()
        r = max(r, b[i][j])
        for di in range(-1, 2):
          i1 = i + di
          if 0 <= i1 < h:
            for dj in range(di % 2 - 1, 2, 2):                
              j1 = j + dj
              if 0 <= j1 < w and b[i1][j1] == '.':
                b[i1][j1] = b[i][j] + 1
                q.append((i1, j1))
print(r)


Measured memory_bytes: 3316