akhauriyash/Code-Regression huggingface dataset:
// https://atcoder.jp/contests/code-festival-2016-qualc/tasks/codefestival_2016_qualC_c
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define BIT(n) (1LL << (n))
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

template <int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod)
            x -= mod;
    }
    ModInt &operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0)
            x += mod;
        return *this;
    }
    ModInt &operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt &operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
    friend ostream &operator<<(ostream &s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream &operator>>(istream &s, ModInt<mod> &a) {
        s >> a.x;
        return s;
    }
};
using mint = ModInt<(int)1e9 + 7>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> t(n), a(n), cnt(n, 1);
    REP(i, n) cin >> t[i];
    REP(i, n) cin >> a[i];
    if (a[0] != t[n - 1]) {
        cout << "0\n";
        return 0;
    }
    bool flag = true;
    FOR(i, 1, n - 1) {
        // 左から見たときに山の高さが更新
        if (t[i] > t[i - 1]) {
            // 右から見たときの山の高さを見る
            if (t[i] > a[i]) {
                flag = false;
                break;
            }
        }
        // 右から見たときに山の高さが更新
        else if (a[i + 1] < a[i]) {
            // 左から見たときの山の高さを見る
            if (a[i] > t[i]) {
                flag = false;
                break;
            }
        } else {
            cnt[i] = min(t[i], a[i]);
        }
    }
    if (!flag) {
        cout << "0\n";
    } else {
        mint ans = 1;
        REP(i, n) { ans *= cnt[i]; }
        cout << ans << endl;
    }
    // for (auto x : cnt) {
    //     cout << x << " ";
    // }

    return 0;
}


Measured memory_bytes: 1408
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            for (int i = 0; i < (input.Length / 2); i++)
            {
                if (input[i] != input[input.Length - (i + 1)])
                {
                    Console.WriteLine("No");
                    return;
                }
            }

            Console.Write("Yes");
            return;
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
vector<int> v;
int n,a,ans,cnt;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        v.push_back(a);
    }
    cnt=200001;
    for(int i=0;i<n;i++){
        if(v[i]<=cnt)ans++;
        cnt=min(cnt,v[i]);
    }
    cout<<ans<<endl;
}


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

using namespace std;
#define LL long long
LL a[1005],b[1005],c[1005];

vector <LL> ans;
LL cmp(LL x,LL y)
{
    return x>y;
}
int main()
{
    LL x,y,z,k;
    while(cin>>x>>y>>z>>k)
    {
        for(int i=0;i<x;i++)
            cin>>a[i];
        for(int i=0;i<y;i++)
            cin>>b[i];
        for(int i=0;i<z;i++)
            cin>>c[i];
        sort(a,a+x,cmp);
        sort(b,b+y,cmp);
        sort(c,c+z,cmp);
        for(int i=0;i<x;i++)
        {
            for(int j=0;j<y;j++)
            {
                for(int l=0;l<z;l++)
                {
                    if((i+1)*(j+1)*(l+1)<=k)
                        ans.push_back(a[i]+b[j]+c[l]);
                    else break;
                }
            }
        }
        sort(ans.begin(),ans.end(),cmp);
        for(int i=0;i<k;i++)
        {
            cout<<ans[i]<<endl;
        }
    }
    return 0;
}


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

vector<vector<int>> adj;
vector<int> vis;


void dfs(int n)
{
	vis[n]=1;
	for(auto i :adj[n])
	{
		if(vis[i]!=1)
			dfs(i);
	}
}

 
int main()
{ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
   adj.resize(n+1,vector<int>());
   vis.resize(n+1,0);
   int a,b;
   for(int i=0;i<m;i++)
   {
   		cin>>a>>b;
   		adj[a].push_back(b);
   		adj[b].push_back(a);
   }
   int ans=0;
   for(int i=1;i<=n;i++)
   {
   		if(vis[i]!=1)
   		{
   			ans++;
   			dfs(i);
   		}
   }
   cout<<ans-1<<endl;
	return 0;

}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int h, w;
    cin >> h >> w;
    vector<vector<pair<int,int>>> grid(h, vector<pair<int,int>>(w));
    REP(i, h){
        REP(j, w){
            cin >> grid[i][j].first;
        }
    }
    REP(i, h){
        REP(j, w){
            cin >> grid[i][j].second;
        }
    }

    vector<vector<int>> v(h, vector<int>(w));
    REP(i, h){
        REP(j, w){
            v[i][j] = abs(grid[i][j].first - grid[i][j].second);
        }
    }

    int m = (h+w)*100;

    vector<vector<vector<bool>>> dp(h, vector<vector<bool>>(w, vector<bool>(m, false)));

    REP(i, h){
        REP(j, w){
            if(i == 0 && j == 0){
                dp[0][0][v[0][0]] = true;
                continue;
            }
            if(i > 0){
                REP(k, m){
                    if(dp[i-1][j][k]){
                        dp[i][j][k + v[i][j]] = true;
                        dp[i][j][abs(k - v[i][j])] = true;
                    }
                }
            }
            if(j > 0){
                REP(k, m){
                    if(dp[i][j-1][k]){
                        dp[i][j][k + v[i][j]] = true;
                        dp[i][j][abs(k - v[i][j])] = true;
                    }
                }
            }
        }
    }

    int ans = inf;

    REP(i, m){
        if(dp[h-1][w-1][i]){
            ans = i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 13312
# Aizu Problem 0036: Figure on Surface
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def get_figure(figure):
    for frow in range(8):
        if '1' in figure[frow]:
            fcol = figure[frow].find('1')
            break
    figure = figure[frow:]
    frow = 0
    ones = []
    min_col = 9
    for row in range(len(figure)):
        for col in range(8):
            if figure[row][col] == '1':
                ones.append([row, col])
                min_col = min(min_col, col)
    for k in range(len(ones)):
        ones[k][1] -= min_col
    if ones == [[0, 0], [0, 1], [1, 0], [1, 1]]:
        return 'A'
    elif ones == [[0, 0], [1, 0], [2, 0], [3, 0]]:
        return 'B'
    elif ones == [[0, 0], [0, 1], [0, 2], [0, 3]]:
        return 'C'
    elif ones == [[0, 1], [1, 0], [1, 1], [2, 0]]:
        return 'D'
    elif ones == [[0, 0], [0, 1], [1, 1], [1, 2]]:
        return 'E'
    elif ones == [[0, 0], [1, 0], [1, 1], [2, 1]]:
        return 'F'
    elif ones == [[0, 1], [0, 2], [1, 0], [1, 1]]:
        return 'G'
    else:
        return '?'

    
while True:
    figure = [input().strip() for _ in range(8)]
    print(get_figure(figure))
    try:
        dummy = input()
    except EOFError:
        break
    

Measured memory_bytes: 7624
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, 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;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  vector<int> a(N), b(N), c(N);
  rep(i, N) cin >> a[i] >> b[i] >> c[i];

  vector<vector<int>> dp(N + 10, vector<int>(3, 0));

  for (int i = 0; i < N; ++i){
    for (int j = 0; j < 3; ++j){
      if (j == 0) {
        chmax(dp[i + 1][1], dp[i][0] + a[i]);
        chmax(dp[i + 1][2], dp[i][0] + a[i]);
      }
      else if (j == 1){
        chmax(dp[i + 1][0], dp[i][1] + b[i]);
        chmax(dp[i + 1][2], dp[i][1] + b[i]);
      }
      else{
        chmax(dp[i + 1][0], dp[i][2] + c[i]);
        chmax(dp[i + 1][1], dp[i][2] + c[i]);
      }
    }
  }
  //cout << max({dp[N - 1][0], dp[N - 1][1], dp[N - 1][2]}) << endl;
  cout << max({dp[N][0], dp[N][1], dp[N][2]}) << endl;
}


Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;
// mp::cpp_int
// mp::cpp_dec_float_100
#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  
  //vector<ll> a(n);  rep(i, 0, n) cin >> a[i];
  
  while(a>0 and c>0) {
    c -= b;
    if(c > 0)
      a -= d;
  }
  
 // cout <<  << "\n";
  
  cout << (c<= 0 ?"Yes" :"No") << "\n";
  
  //cout << fixed << setprecision(15) << n << "\n";

}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;
//typedef std::pair<std::string,double> P;

long long N, A, B;
string s; 
void solve(){
    if((B-A-1)%2!=0){
        cout << "Alice" << endl;
    }else{
        cout << "Borys" << endl;
    }
    
    
}
int main() {
    cin >> N >> A >> B;
    solve();
	return 0;
}

Measured memory_bytes: 256
class abc_166:
    
    def __init__(self):
        pass
    
    def A(self):
        S=input()
        ans= "ARC" if S=="ABC" else "ABC"
        print(ans)
    
    def B(self):
        pass
            
    def C(self):
        pass
    
    def D(self):
        pass
    
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_166()
    obj.A()

Measured memory_bytes: 61912
#[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 solve(ss: Vec<Vec<char>>) -> bool {
    let h = ss.len();
    let w = ss[0].len();

    for i in 0..h {
        for j in 0..w {
            if ss[i][j] == '.' { continue }

            if i > 0 && ss[i-1][j] == '#' { continue }
            if i < h-1 && ss[i+1][j] == '#' { continue }
            if j > 0 && ss[i][j-1] == '#' { continue }
            if j < w-1 && ss[i][j+1] == '#' { continue }

            return false
        }
    }

    true
}

fn main() {
    let (h, _w) = parse_line!(usize, usize);

    println!("{}", if solve((0..h).map(|_| read_line!().chars().collect()).collect()) {
        "Yes" } else { "No" });
}

#[test]
fn solve_test() {
    assert_eq!(solve(vec![".#.".chars().collect(),
                          "###".chars().collect(),
                          ".#.".chars().collect()]), true);
}


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

int main() {
    long long int N;
    std::cin >> N;

    std::vector<long long int> f(N + 1, 0);

    long long int sum = 0;
    for (int i = 1; i <= N; i++) {
        for (int j = i; j <= N; j += i) {
            f[j]++;
        }
        sum += f[i] * i;
    }
    std::cout << sum << std::endl;
}


Measured memory_bytes: 81396
# -*- coding: utf-8 -*-

n = str(input())

hon = ['2', '4', '5', '7', '9']
pon = ['0', '1', '6', '8']
bon = ['3']

if n[-1] in hon:
    print('hon')
elif n[-1] in pon:
    print('pon')
else:
    print('bon')

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

const int N = 55;
double n, a[N];
double ans;

int main() {
    cin >> n;
    rep(i, 1, n) cin >> a[i];
    sort(a + 1, a + (int)n + 1);
    ans = (a[1] + a[2]) / 2;
    rep(i, 3, n) ans = (ans + a[i]) / 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
def get_sieve_of_eratosthenes(n):
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
sosuu=get_sieve_of_eratosthenes(55555)
sosuu_5=[]
for i in sosuu:
    if i%5==1:
        sosuu_5.append(i)
ans=''
for i in sosuu_5[:n]:
    ans=ans+str(i)+' '
print(ans)


Measured memory_bytes: 41836
#include <stdio.h>          // printf(), scanf()

#define MAX_V 15
#define min(a, b) ((a) < (b) ? (a) : (b))

static const int INF = 1000000000;

int d[MAX_V][MAX_V];
int dp[1 << MAX_V][MAX_V];
int V;

int
solve()
{
	int S, u, v;

	for (S = 0; S < (1 << V); ++S)
	{
		for (v = 0; v < V; ++v)
			dp[S][v] = INF;
	}

	dp[(1 << V) - 1][0] = 0;
	for (S = (1 << V) - 2; S >= 0; --S)
	{
		for (v = 0; v < V; ++v)
		{
			for (u = 0; u < V; ++u)
			{
				if (!(S >> u & 1))
				{
					int t = dp[S | (1 << u)][u] + d[v][u];
					dp[S][v] = min(dp[S][v], t);
				}
			}
		}
	}

	return dp[0][0];
}

int
main(int argc, char** argv)
{
	int E;
	int s, t, c;
	int i, j;

	scanf("%d %d", &V, &E);
	for (i = 0; i < V; ++i)
	{
		for (j = 0; j < V; ++j)
		{
			if (i == j)
				d[i][j] = 0;
			else
				d[i][j] = INF;
		}
	}

	for (i = 0; i < E; ++i)
	{
		scanf("%d %d %d", &s, &t, &c);
		d[s][t] = c;
	}


	int res = solve();
	if (res == INF)
		res = -1;

	printf("%d\n", res);
	return 0;
}

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

int main() {
    int N, ans = 0, x = 0;
    string S;
    cin >> N >> S;
    for (int i = 0; i < S.length(); i++) {
        if (S[i] == 'I') x++;
        else x--;
        ans = max(ans, x);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [[0 for _ in range(2)] for _ in range(N)]
for i in range(N):
    A[i] = list(map(int,input().split()))
if len(A) % 2 == 1:
    max_A = [A[i][1] for i in range(N)]
    min_A = [A[i][0] for i in range(N)]
    max_A.sort()
    min_A.sort()
    max_ = max_A[(len(A))//2]
    min_ = min_A[(len(A))//2]
    print(max_ - min_ + 1)

else:
    max_A = [A[i][1] for i in range(N)]
    min_A = [A[i][0] for i in range(N)]
    max_A.sort()
    min_A.sort()
    max_ = max_A[(len(A))//2]
    max_c = max_A[(len(A))//2 - 1]
    min_ = min_A[(len(A))//2]
    min_c = min_A[(len(A))//2 - 1]
    aa = (max_ + max_c) / 2.0
    bb = (min_ + min_c) / 2.0
    print(int(2 * (aa-bb)) + 1)

Measured memory_bytes: 49360
N = input()

keta = len(N)

dp = [[10**18 for i in range(2)] for j in range(keta)]

t = int(N[-1])

dp[0][0] = t
dp[0][1] = 10 - t

for i in range(keta - 2, -1, -1):
    
    t = int(N[i])
    #print(keta-i,i,t)
    dp[keta-i-1][0] = min(dp[keta-i-2][0]+t,dp[keta-i-2][1]+t+1)
    dp[keta-i-1][1] = min(dp[keta-i-2][0]+(10-t),dp[keta-i-2][1]+(10-(t+1)))
    #a, b = min(a + t, b + (t + 1)), min(a + (10 - t), b + (10 - (t + 1)))

#print(dp)

print(min(dp[keta-1][0],dp[keta-1][1]+1))

Measured memory_bytes: 155684
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int N;

int main()
{
    cin >> N;
    for (int i = 0; i < 3; i++)
    {
        int a = N % 10;
        if (a == 7)
        {
            cout << "Yes" << endl;
            return 0;
        }
        N /= 10;
    }
    cout << "No" << endl;
}

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

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

    int len = s.length();
    int a = (len - 1) / 2 - 1;
    int b = (len + 3) / 2 - 1;

    int flag = 0;
    for(int i = 0; i < len / 2 - 1; i++){
        if(s[i] != s[len - 1 - i]){
            flag = 1;
            break;
        }
    }

    if(flag == 0){
        for(int i = 0; i < a / 2; i++){
            if(s[i] != s[a - i]){
                flag = 1;
                break;
            }
        }
    }

    if(flag == 0){
        for(int i = 0; i < (len - b) / 2; i++){
            if(s[b + i] != s[len - 1 - i]){
                flag = 1;
                break;
            }
        }
    }

    if(flag == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

using namespace std;

int main(){
    long long int a, b, c;
    cin >> a >> b >> c;
    long long int d = c-b-a;
    if(d < 0){
        cout << "No";
        return 0;
    }
    if(d * d - 4 * a * b > 0){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a1,a2,a3,a4,s;
	int b1,b2,b3,b4,z;
	scanf("%d %d %d %d",&a1,&a2,&a3,&a4);
	s=a1+a2+a3+a4;
	scanf("%d %d %d %d",&b1,&b2,&b3,&b4);
	z=b1+b2+b3+b4;
	if(s>=z){
		printf("%d\n",s);
	}
	else if(z>s){
		printf("%d\n",z);
	}
	return 0;
}

Measured memory_bytes: 1020
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

int f[256][256][1<<5][1<<5];

int main(void) {
  int N, C;
  scanf("%d %d", &N, &C);
  vector<int> a(N);
  REP(i, N) scanf("%d", &a[i]);

  sort(a.begin(), a.end());
  N--;

  int M = C * N; // 250

  f[M][M][0][0] = 1;
  for (int cur = M; cur > 0; --cur) {
    for (int prev = M; prev > 0; --prev) {
      for (int mask1 = 0; mask1 < (1<<N); ++mask1) {
        for (int mask2 = 0; mask2 < (1<<N); ++mask2) {
          f[cur - 1][prev][mask1][mask2] += f[cur][prev][mask1][mask2];

          if (mask2 & (1<<((cur - 1) % N))) continue;

          for (int i = 0; i < N; ++i) {
            if ((mask1 & (1<<i)) == 0) {
              
              int x1 = (cur - 1) / N + a[i];
              int y1 = (cur - 1) % N;
              
              int x2 = prev / N;
              int y2 = prev % N;

              int ncur = cur - 1;
              int nprev = prev;
              int nmask1 = mask1 | (1<<i);
              int nmask2 = mask2 | (1<<y1);
              if (x1 > x2 || (x1 == x2 && y1 >= y2)) {
                nprev = cur - 1;
              }

              f[ncur][nprev][nmask1][nmask2] += f[cur][prev][mask1][mask2];
            }
          }
        }
      }
    }
  }

  llint ways = 0;
  REP(i, a[N] * N) {
    ways += f[0][i][(1<<N)-1][(1<<N)-1];
  }

  llint total = 1;
  REP(i, N) total *= i + 1;
  REP(i, N) total *= C;

  printf("%.15f\n", ways * 1.0 / total);
  return 0;
}


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

#define  pf                  printf
#define  sc                  scanf
#define  PI                  2*acos(0.0)
#define  fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define  mem(a,b)            memset(a, b, sizeof(a) )
#define  gcd(a,b)            __gcd(a,b)
#define  lcm(a,b)            (a*(b/gcd(a,b)))
#define  MAX                 1234567899
#define  mod                 1000000007
#define  all(v)              (v).begin(),(v).end()
#define  vSort(v)            sort(all(v))
#define  maxSort(v)          sort(all(v),greater<int>())
#define  Unique(v)           v.erase(unique(all(v)),v.end())
#define  sqr(x)              ((x)*(x))
#define  qube(x)             ((x)*(x)*(x))
#define  deci(n)             cout<<fixed<<setprecision(n)
#define  sci(n)              sc("%d",&(n))
#define  scii(x,y)           sc("%d %d",&(x),&(y))
#define  scl(x)              sc("%lld",&(x))
#define  scll(x,y)           sc("%lld %lld",&(x),&(y))
#define  vi                  vector<int>
#define  hi                  pf(" HI \n")
#define  pp                  pair<int,int>
#define  pb(x)               push_back(x)
#define  mp(x,y)             make_pair(x,y)
#define  F                   first
#define  S                   second
#define  check(n,pos)        (n & (1<<(pos)))
#define  biton(n,pos)        (n  (1<<(pos)))
#define  bitoff(n,pos)       (n & ~(1<<(pos)))
typedef  long long int       lli;
typedef  unsigned long long int ulli;
int dx4[] = { 0, 0, -1, 1 } ;
int dy4[] = { -1, 1, 0, 0 } ;
bool valid( int r, int c, int x, int y )
{
    if( x >= 1 && x <= r && y >= 1 && y <= c ) return 1 ;
    return 0 ;
}

using namespace std;
int a[3003][3003];
vector<char>v;
string s,s1;
int m,n;
int lcs(string s,string s1,int m,int n)
{

    for(int i=0; i<=m; i++)
    {
        for(int j=0; j<=n; j++)
        {
            if(i==0 || j==0)
                a[i][j]=0;
            else if(s[i-1]==s1[j-1])
            {

                a[i][j]=1+a[i-1][j-1];
            }
            else
            {
                a[i][j]=max(a[i][j-1],a[i-1][j]);
            }
        }
    }
    return a[m][n];
}

void print_lcs(int index)
{
    int i=m,j=n;
    while(i>0 && j>0)
    {
        if(s[i-1]==s1[j-1])
        {
            v.pb(s[i-1]);
            i--;
            j--;
        }
        else if(a[i][j-1]>a[i-1][j])
            j--;
        else
            i--;
    }
    for(int i=v.size()-1 ; i>=0; i--)
        cout << v[i];
    cout <<endl;
}
int main ()
{
        cin >> s >> s1;
        m=s.length();
        n=s1.length();
        int ans=lcs(s,s1,m,n);
        //cout << ans <<endl;
        print_lcs(ans);
    
    return 0;
}




Measured memory_bytes: 35456
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const int MAX_N = 1 << 19;

ll nn, dat[2 * MAX_N - 1];
const ll INF = 1001001001001001001;

void init(int n_){
    if(n_ < 10)n_ = 10; // n_が小さいときの変な挙動を防ぐ
    nn = 1;
    while(nn < n_)nn *= 2;
    for(int i = 0; i < 2 * nn - 1; i++)dat[i] = -INF;
}

// k番目の値(0-indexed)をaに変更
void update(int k, ll a){
    k += nn - 1;
    dat[k] = a;
    while(k > 0){
        k = (k - 1) / 2;
        dat[k] = max(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
}

// [a,b)の最小値を求める
// 後ろのほうの引数は、計算の簡単のための引数。
// kは節点の番号、l, rはその節点が[l, r)に対応づいていることを表す。
// したがって、外からはquery(a, b, 0, 0, nn)として呼ぶ。
ll query2(int a, int b, int k, int l, int r){
    if (r <= a || b <= l)return -INF;
    if (a <= l && r <= b)return dat[k];
    else {
        ll vl = query2(a, b, k * 2 + 1, l, (l + r) / 2);
        ll vr = query2(a, b, k * 2 + 2, (l + r) / 2, r);
        return max(vl, vr);
    }
}

// [a,b)の最小値を求める
ll query(int a, int b){ 
    return query2(a, b, 0, 0, nn);
}

int main(){
    int n, k;
    cin >> n >> k;
    init(310000);

    rep(i,300001){
        update(i,0);
    }

    int ans = 0;
    rep(i,n){
        int a;
        cin >> a;
        int l = a - k;
        int r = a + k + 1;
        l = max(l,0);
        r = min(r,300100);
        int tmp = query(l,r);
        tmp++;
        update(a,tmp);
        ans = max(ans,tmp);
    }

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



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

int main() {
	int h,m,s,S;
	cin >> S;
	
	h=S/3600;
	m=S%3600/60;
	s=S%3600%60%60;
	cout << h << ':' << m << ':' << s <<endl;
	
	return 0;
}

Measured memory_bytes: 1160
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            out.println(in.nextInt() - in.nextInt() + 1);
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufPointer >= bufLength) {
                if (bufLength == -1)
                    throw new InputMismatchException();

                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (bufLength <= 0)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public long nextLong() {
            long n = 0;

            int b = readByte();
            while (isSpaceChar(b))
                b = readByte();

            boolean minus = (b == '-');
            if (minus)
                b = readByte();

            while (b >= '0' && b <= '9') {
                n *= 10;
                n += b - '0';
                b = readByte();
            }

            if (!isSpaceChar(b))
                throw new NumberFormatException();

            return minus ? -n : n;
        }

        public int nextInt() {
            long n = nextLong();

            if (n < Integer.MIN_VALUE || n > Integer.MAX_VALUE)
                throw new NumberFormatException();

            return (int) n;
        }

    }
}



Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
	int a,b;cin>>a>>b;
	if(a<=0 && b>=0) cout<<"Zero";
	else if(a>0) cout<<"Positive";
	else if(a<0){
		if((min(b,-1LL)-a+1)&1) cout<<"Negative";
		else cout<<"Positive";
	}
}


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

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

    if((a == b && a != c) || (b == c && b != a) || (c == a && c != b)){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

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

int main()
{
    int n;
    while(cin >> n,n!=1){
        cout<<n<<":";
        int sat=0;
        vector<int> vsat;
        vsat.push_back(1);
        if(!(n%6)){
            vsat.push_back(6);
            cout << " " << 6;
        }
        for(int m=1;sat<=n;m++){
            sat=7*m+1;
            if(!(n%sat)){
                for(unsigned int i=0;i<vsat.size();i++){
                    if(i!=0&&!(sat%vsat[i])) break;
                    if(i==vsat.size()-1){
                        vsat.push_back(sat);
                        cout << " " << sat;
                    }
                }
            }
            sat=7*m+6;
            if(!(n%sat)){
                for(unsigned int i=0;i<vsat.size();i++){
                    if(i!=0&&!(sat%vsat[i])) break;
                    if(i==vsat.size()-1){
                        vsat.push_back(sat);
                        cout << " " << sat;
                    }
                }
            }
        }
        
        cout << endl;
    }
}

Measured memory_bytes: 3164
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math


mod=10**9+7
mod
ferumaC=10000
fac=[0 for i in range(ferumaC)]
fac[0]=1
ifac=[0 for i in range(ferumaC)]
ifac[0]=1
def mpow(x,n):
    num=1
    while n > 0:
        if n&1:
            num=num*x%mod
        x=x*x%mod
        n=n>>1
    return(num)

for i in range(0,ferumaC-1):
    fac[i+1]=(fac[i]*(i+1))%mod
    ifac[i+1]=ifac[i]*mpow(i+1,mod-2)%mod
def comb(a,b):
    if a==0 and b==0:return(1)
    if a<b or a<0:return(0)
    tmp=ifac[a-b]*ifac[b]%mod
    return(tmp*fac[a]%mod)



sosuulst={}
def soinsuu(i):
    for s in sosuulst:
        while i%s==0:
            sosuulst[s]+=1
            i//=s
    if i>1 and  not i in sosuulst :
        sosuulst.update({i:1})


N=int(input())
for i in range(2,N+1):
    soinsuu(i)


data=[sosuulst[i] for i in sosuulst]
#print(data)
count=0
for lst in [[2,4,4],[2,24],[4,14],[74]]:
    lst.reverse()
    flag=0
    temp=1
    if len(lst)<=2:
        for m,l in enumerate(lst):
            A=len([i for i in data if i>=l])-m
            if A<=0:
                flag=1
                break
            temp*=A


    else:
        A=len([i for i in data if i>=4])
        if A<=1:
            continue
        A=comb(A,2)
        temp*=A
        A=len([i for i in data if i>=2])-2
        if A<=0:
            continue
        temp*=A
    if not flag:
        #print(temp)
        count+=temp
print(count)


Measured memory_bytes: 40048
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  int a, b, c;
  readf("%s %s %s\n", &a, &b, &c);
  writeln(b + min(a+b+1, c));
}


Measured memory_bytes: 256
# 先に組み合わせの数を決める
# RとGとBの数を先に数え上げると、Rの数 * Gの数 * Bの数が組み合わせの数になる
# 累積和でもできる

#組み合わせの数は
kumiawase = 0
countR=0
countG=0
countB=0
N = int(input())
S = list(input())
for i in range(N):
    if(S[i] == "R"):
        countR += 1
    elif(S[i] == "G"):
        countG += 1
    elif(S[i] == "B"):
        countB += 1
kumiawase = countR * countG * countB

count = 0
#その組み合わせの数から、j-i = k-jをみたす数を引けばいい
#条件を満たし、かつ1つ目の条件を満たすものは
for i in range(N):
    for j in range(i+1, N):
        k = 2 * j - i
        if(k < N):
            if(S[i] != S[j] and S[i] != S[k] and S[j] != S[k]):
                count+=1

print(kumiawase - count)

Measured memory_bytes: 68260
a, b = map(int, input().split())

for i in range(1, 10 ** 4):
    x = int(i * 0.08)
    y = int(i * 0.1)
    if x == a and y == b:
        print(i)
        exit()
    if x > a and y > b:
        print(-1)
        exit()

print(-1)

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

using namespace std;

#define pb push_back
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef pair <ll, ll> pi;

ll a, b, c, d, g, ans;

ll f(ll x) {
    ll res = b / x - (a - 1) / x;
    return res;
}

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

int main() {
    fio;
    cin >> a >> b >> c >> d;
    g = (c * d) / gcd(c, d);
    ans = f(c) + f(d) - f(g);
    ans = (b - a + 1) - ans;
    cout << ans << endl;
    return 0;
}

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

int main (){
    int a,b;
    cin >> a ;
    if(a<1200){
        cout <<"ABC"<< endl;
    }else if(a<2800){
        cout << "ARC" << endl;
    }else{
        cout << "AGC" << endl;
    }
}

Measured memory_bytes: 256
// doot diddly donger cuckerino Hahahahahah

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long int LL;
typedef unsigned int UINT;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<string, int> PSI;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef tuple<int, int, int> TPL;
typedef priority_queue<int> pqueue;
typedef priority_queue<int, VI, greater<>> pdqueue;

const int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, 1, 0, -1, -1, 1, -1, 1};
const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define endl '\n'
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define F first
#define S second
#define SZ(x)           ((int) (x).size())
#define MAX(a, b)      ((a)>(b)?(a):(b))
#define MIN(a, b)      ((a)<(b)?(a):(b))
#define ALL(a)         std::begin(a), std::end(a)
#define Fill(n, x)      memset(n,x,sizeof n);
#define IN_REP         int _t; cin >> _t ; while(_t--)
#define IOS            ios::sync_with_stdio(false);cin.tie(NULL)
#define FORD            for(int i=(a);i<(b);i+=(c))
#define FOR(i, a, b)    for(int i=(a);i<(b);i++)
#define REP(i, n)       FOR(i,0,n)
#define FORR(i, n)      for(int i=(n);i>=0;i--)
#define EPS (double) 1e-9
#define MOD (long long)(1000*1000*1000 + 7)
#define INF 1011111111
#define LLINF 1000111000111000111LL
#define MAXN 5000007

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

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

template<typename T>
inline void add(T &x, T y) {
    x += y;
    if (x >= MOD) x -= MOD;
}

template<typename T>
inline void sub(T &x, T y) {
    x -= y;
    if (x < 0) x += MOD;
}

template<typename T>
inline T mul(T a, T b) {
    LL x = (long long) a * b;
    x %= MOD;
    return x;
}

template<typename T>
inline T power(T base, T exp) {
    T result = 1;
    while (exp) {
        if (exp & 1)result *= base;
        exp >>= 1;
        base *= base;
    }
    return result;
}

template<typename T>
inline T power(T a, T b, T mod) {
    T res = 1;
    while (b > 0) {
        if (b & 1) { res = mul(res, a); }
        a = mul(a, a);
        b >>= 1;
    }
    return res;
}

template<typename T>
inline T modInverse(T n, T p) { return power(n, p - 2, p); }

template<typename T>
inline bool isPrime(T n) {
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (LL i = 5; i * i <= n; i += 6) { if ((n % i == 0) || (n % (i + 2) == 0)) { return false; }}
    return true;
}

int main() {
    string s;
    cin >> s;
    int cb = 0;
    LL ans = 0;
    for (char c: s) {
        if (c == 'B') {
            ++cb;
        } else {
            ans += cb;
        }
    }
    cout << ans << "\n";
    return 0;
}

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

#define MAX_N 10000
#define MAX_K 10

using namespace std;

bool strCheck(string n_str, int *k_array, int k);

int main(){

  int n=MAX_N, k=MAX_K;
  bool non=false;
  string n_str;
  int temp;
  int *k_array;

  cin >> n_str >> k;
  // n_str = "1999";
  // k = 8;

  n = stoi(n_str);
  k_array = new int[k];

  int i = 0;
  while (i<k && cin >> temp){
    if (i<k){
      k_array[i] = temp;
      i++;
    }
  }

  // int init_k_array[8] = {1, 3, 4, 5, 6, 7, 8, 9};
  // k_array = init_k_array;

  do{
    non = strCheck(n_str, k_array, k);
    if (non){
      n++;
      n_str = to_string(n);
    }
  } while(non);

  cout << n << endl;
  return 0;
}

bool strCheck(string n_str, int *k_array, int k){
  bool non;
  for (size_t i = 0; i < n_str.size(); i++){
    for (int j = 0; j < k; j++){
      string temp;
      temp = n_str[i];
      if (stoi(temp) == k_array[j]){
        non = true;
        return non;
      } else{
        non = false;
      }
    }
  }
  return non;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define int long long
#define P pair<long,long>
using namespace std;
 
inline int lcm(int a,int b){
    if(a<b) swap(a,b);
    int n=a,m=b;
    while(a%b!=0){
        int t=b;
        b=a%b;
        a=t;
    }
    return n/b*m;
}
 
signed main(){
  int a;
  cin>>a;
  int c=1;
  vector<int> b(a);
  rep(i,a)
    cin>>b.at(i);
  rep(i,a)
    c=lcm(c,b.at(i));
    cout<<c;
  }
    

Measured memory_bytes: 256
// ========================================================================================================
// Library
// ========================================================================================================
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
using namespace std;

// competitive macro
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i ,n) for (int i = (n) - 1; i >= 0; i--)
#define LL long long
#define ULL unsigned long long

void fastIOS()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}
// ========================================================================================================
// ========================================================================================================

int main()
{
	fastIOS();

	int h,a; cin >> h >> a;
    
    cout << ceil(h/(double)a)  << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <algorithm>

using namespace std;

int main() {
    double x1, x2, xp, y1, y2, yp, slope, ansx, ansy;
    int    q;
    bool   X_FLG = false, Y_FLG = false;

    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    scanf("%d", &q);

    if (y1 == y2) {
        X_FLG = true;
    } else if (x1 == x2) {
        Y_FLG = true;
    } else {
        slope = (y2 - y1) / (x2 - x1);
    }

    for (int i = 0; i < q; i++) {
        scanf("%lf %lf", &xp, &yp);
        if (X_FLG) {
            printf("%.10lf %.10lf\n", xp, y1);
        } else if (Y_FLG) {
            printf("%.10lf %.10lf\n", x1, yp);
        } else {
            ansx = (yp * (x2 - x1) * (y2 - y1) + xp * (x2 - x1) * (x2 - x1) -
                    y1 * (y2 - y1) * (x2 - x1) + x1 * (y2 - y1) * (y2 - y1)) /
                   ((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1));
            ansy = ((x1 - x2) * ansx + yp * (y2 - y1) + xp * (x2 - x1)) /
                   (y2 - y1);
            printf("%.10lf %.10lf\n", ansx, ansy);
        }
    }

    return 0;
}



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

int main(){
    int A, B, C, X;
    int ans = 0;
    cin >> A >> B >> C >> X;
    
    for(int i = 0; i <= A; i++){
        for(int j = 0; j <= B; j++){
            if(0 <= (X - (500 * i + 100 * j)) / 10  && C >= (X - (500 * i + 100 * j)) / 50){
                ans++;
            }
        }
    }
    
    cout << ans << endl;
    
    
}


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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m; assert(b>=0); for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int a, b;

signed main() {
	cin >> a >> b;
	if (a<=8 && b<=8) cout << "Yay!" << ln;
	else cout << ":(" << ln;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define MAX 10000

int isPrime(int );

main()
{
  int n, i, num[MAX], count=0;

  scanf("%d", &n);

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

      if(isPrime(num[i]) == 1)
	{
	  count++;
	}
    }

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

  return 0;
}

int isPrime(int x)
{
  int i=3;

  if(x == 2)
    {
      return 1;
    }

  if(x < 2 || x % 2 == 0)
    {
      return 0;
    }

  while(i <= sqrt(x))
    {
      if(x % i == 0)
	{
	  return 0;
	}

      i = i + 2;
    }

  return 1;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  vl x(5);
  ll ans;
  rep(i, 5) {
    cin >> x[i];
    if(x[i] == 0) ans = i + 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

bool dfs(int X, int Y) {
	bool res = false;
	for(int k = 0; k < 2; ++k) {
		for(int i = 2; i <= X; i += 2) {
			res = res || !dfs(X - i, Y + i / 2);
		}
		swap(X, Y);
	}
	return res;
}

signed main(){
	int X, Y;
	cin >> X >> Y;
	if(abs(X - Y) < 2) {
		cout << "Brown" << endl;
	} else {
		cout << "Alice" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>

using namespace std;

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

const int mod=1e9+7;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b&&b==c){
    cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
W = list(map(int,input().split()))

ans = 10**9
for i in range(1,N):
    x = sum(W[0:i])
    y = sum(W[i:])
    ans = min(ans, abs(x-y))

print(ans)

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

int main(){
    ll l,r;
    cin >> l >> r;
    ll lm,rm;
    
    lm=l%2019;
    rm=r%2019;
    int ans,ans2;

    //cout << rm << lm << endl;
    if(lm>=rm or r-l>2019){
        ans=0;
    }
    else{
        ans=10000;
        rep(i,rm-lm+1){
            rep(j,rm-lm+1-i-1){
                ans2=((i+lm)*(i+j+lm+1))%2019;
                ans=min(ans,ans2);
            }
        }
    }

    cout << ans << endl;
    

    return 0;
}

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

int main(void){
  int n;
  long long sum = 0, monsters = 0;
  cin >> n;
  vector<int> a(n+1);
  for(int i = 0; i < n+1; i++){
    cin >> a[i];
    monsters += a[i];
  }
  vector<int> b(n);
  for(int i = 0; i < n; i++){
    cin >> b[i];
  }

  for(int i = 0; i < n; i++){
    for(int j = 0; j < 2; j++){
      if(a[i+j] <= b[i]){
        sum += a[i+j];
        b[i] -= a[i+j];
        a[i+j] = 0;
      } else{
        a[i+j] -= b[i];
        sum += b[i];
        b[i] = 0;
      }
    }
  }
  if(sum < monsters) cout << sum << endl;
  else cout << monsters << endl;
  return 0;
}


Measured memory_bytes: 1024