akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << max(A * B, C * D) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        int c = input.nextInt();
        if(a<b&&b<c){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    }
}


Measured memory_bytes: 26376
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define INF 1e9
using ll = std::int64_t;

template <class T>
bool chmax(T &a, const T &b);
template <class T>
bool chmin(T &a, const T &b);
//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b);
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb);
//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str);
//素数判定
bool is_prime(std::int64_t n);
// 約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n);
// 素因数分解
std::map<std::int64_t, std::int64_t> prime_factor(std::int64_t n);

//10^9 + 7
#define yojo 1000000007
#define MAX_NUM 200001

void Main()
{
  int a, b;
  cin >> a >> b;
  std::cout << ((a * b) % 2 == 0 ? "Even" : "Odd") << std::endl;

  return;
}

int main()
{
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

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

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

//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b)
{
  // a >= b && b != 0
  std::int64_t c;
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//最大公約数安全版
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb)
{
  std::int64_t a = max(aa, bb);
  std::int64_t b = min(aa, bb);
  std::int64_t c;
  if (b == 0)
  {
    return -1;
  }
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str)
{
  std::vector<std::pair<char, std::int64_t>> data;
  char now = str[0];
  std::int64_t count = 0;
  for (std::int64_t i = 0; i < str.size() + 1; i++)
  {
    if (i == str.size())
    {
      data.push_back(make_pair(str[i - 1], count));
      break;
    }
    else if (now != str[i])
    {
      data.push_back(make_pair(now, count));
      now = str[i];
      count = 0;
    }
    count++;
  }

  return data;
}

//素数判定
bool is_prime(std::int64_t n)
{
  for (std::int64_t i = 0; i * i <= n; i++)
  {
    if (n % i == 0)
    {
      return false;
    }
  }

  return n != 1;
}

//約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n)
{
  std::vector<std::int64_t> res;
  for (int i = 0; i < n; i++)
  {
    if (n % i == 0)
    {
      res.push_back(i);
      if (i != n / i)
        res.push_back(n / i);
    }
  }
  return res;
}

// 素因数分解
std::map<std::int64_t, std::int64_t> prime_factor(std::int64_t n)
{
  std::map<std::int64_t, std::int64_t> res;
  for (int i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      ++res[i];
      n /= i;
    }
  }

  if (n != 1)
  {
    res[n] = 1;
  }

  return res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
typedef long long ll;
ll INF = 1001001001;
int main() {
  string S; cin >> S;
  int count = 0;
  int N = S.size();
  
  for(int i=0; i<N-1;i++){
    
    if((S[i]==S[i+1]) && (S[i+1]=='0')){ 
      count++; S[i+1]='1';
    }
    
     else if((S[i]==S[i+1]) && (S[i+1]=='1')) {
     count++; S[i+1]='0'; 
    }
  }
cout << count << endl;
}

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

#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)

namespace std {
	template<class S, class T> pair<S, T> operator + (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first + b.first, a.second + b.second);}
	template<class S, class T> pair<S, T> operator - (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first - b.first, a.second - b.second);}
	template<class S, class T> pair<S, T>& operator += (pair<S, T> &a, const pair<S, T> &other) {return a = a + other;}
	template<class S, class T> pair<S, T>& operator -= (pair<S, T> &a, const pair<S, T> &other) {return a = a - other;}
	template<class S, class T> ostream& operator << (ostream& ost, pair<S, T> p) {ost << "(" << p.first << ", " << p.second << ")";return ost;}
	template<class T> ostream& print_iterable_container(ostream& ost, T& container) {
		for (auto&& iter = begin(container); iter != end(container); ++iter) ost << (iter == begin(container) ? " [ " : ", ") << (*iter);
		return ost << " ]";
	}
#	define APPLY_PRINT_ITERABLE_CONTAINER(container_type)\
	template<class T> ostream& operator << (ostream& ost, container_type<T>& container) {\
		return print_iterable_container(ost, container);\
	}
	APPLY_PRINT_ITERABLE_CONTAINER(vector);
	APPLY_PRINT_ITERABLE_CONTAINER(list);
	APPLY_PRINT_ITERABLE_CONTAINER(deque);
}

template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

using ld = long double;

template<class T> using VV = vector<vector<T> >;
template<class T> using maxPQ = priority_queue<T>;
template<class T> using minPQ = priority_queue<T, vector<T>, greater<T> >;
template<class T, class U> using uomap = unordered_map<T, U>;
template<class T> using uoset = unordered_set<T>;

const ll INF = 1001001001;
const ll INFll = (ll)INF * INF;
const ll MOD = 1000000007;
const ll MOD_FFT = 998244353;
const ld EPS = 1e-15;

//function<void(int,int)> tensi_no_3p=[&](int v,int d){
//};

int main() {
	ios_base::sync_with_stdio(false);
	int N; cin >> N;
	vector<pair<ll, pair<ll, ll> > > C(N);
	rep(i, N) {
		ll a, b;
		cin >> a >> b;
		C[i] = mp(a + b, mp(a, b));
	}
	sort(begin(C), end(C));
	reverse(begin(C), end(C));
	ll ans = 0;
	rep(i, N) {
		if (i % 2 == 0) ans += C[i].second.first;
		else ans -= C[i].second.second;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

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

typedef long long ll;
typedef pair<int, int> P;
#define X first
#define Y second

const int MAX = 3005;
const int MOD = 1e9 + 7;

int add(int a, int b)
{
  a += b;
  if (a >= MOD)
    a -= MOD;
  return a;
}

int sub(int a, int b)
{
  a -= b;
  if (a < 0)
    a += MOD;
  return a;
}

int mul(int a, int b)
{
  return (int) (((ll) a * b) % MOD);
}

int pot(int x, int e)
{
  int r = 1;
  for (; e; x = mul(x, x), e /= 2)
    if (e & 1)
      r = mul(r, x);
  return r;
}

int inv(int x)
{
  return pot(x, MOD - 2);
}

int divv(int a, int b)
{
  return mul(a, inv(b));
}

int dp[2][2*MAX][2];
//int *dp[2*MAX];

int main()
{
  //  REP(i, 2*MAX) dp[i] = &__dp[i][MAX];

  int n, m;
  scanf("%d%d", &n, &m);
  
  REP(i, n+1) {
    if (i) dp[0][i][0] = 1;
    else dp[0][i][1] = 1;
  }
  
  int ind = 0;
  REP(i, 2*m) {
    memset(dp[1^ind], 0, sizeof dp[1^ind]);
    
    REP(j, 2*MAX) {
      REP(st, 2) {
	int cnt0 = j, cnt1 = n - j + (i%2);
	if (!dp[ind][j][st]) continue;
	int ja = dp[ind][j][st];
	
	if (cnt0)
	  dp[1^ind][j-1 + (i+1) % 2][st || (j == 1)] = add(dp[1^ind][j-1 +(i+1) % 2][st || (j == 1)], ja);
	if (cnt1)
	  dp[1^ind][j + (i+1) % 2][st] = add(dp[1^ind][j + (i+1) % 2][st], ja);
      }
    }

    ind ^= 1;
  }
  
  int rje = 0;
  REP(i, 2*MAX)
    rje = add(rje, dp[ind][i][1]);

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

  return 0;
}


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


int main() {
  ll n; cin >> n;
  vector<ll> vec1;
  vector<ll> vec2;
  for (ll i = 0;i<n;i++) {
    ll a;
    cin >> a;
    if (i%2==0) {
      vec1.push_back(a);
    }
    else vec2.push_back(a);
  }
  if (n%2==0) {
      reverse(vec2.begin(),vec2.end());
      for (ll i = 0;i<vec2.size();i++) cout << vec2.at(i) << " ";
      for (ll i = 0;i<vec1.size();i++) cout << vec1.at(i) << " ";
  }
  else {
      reverse(vec1.begin(),vec1.end());
      for (ll i = 0;i<vec1.size();i++) cout << vec1.at(i) << " ";
      for (ll i = 0;i<vec2.size();i++) cout << vec2.at(i) << " ";
  }
    
}
  

Measured memory_bytes: 3948
#include<stdio.h>
int a[32];
long long sol(int l,int r,long long xl,long long xr)
{
	if(r==l+1)
	{
		return a[l]*xl+a[r]*xr;
	}
	long long ans=1000000000000000000LL;
	for(int i=l+1;i<r;i++)
	{
		long long ans2=sol(l,i,xl,xl+xr)+sol(i,r,xl+xr,xr)-a[i]*(xl+xr);
		if(ans2<ans)
		{
			ans=ans2;
		}
	}
	return ans;
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	printf("%lld\n",sol(0,n-1,1,1));
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int n;
int b[100005];
int w[100005];
vector<int> v[100005];
void dfs_b(int now,int pre,int count){
    if(pre==-1)b[now]=count;
    for(auto u:v[now]){
        if(u!=pre){
            b[u]=count+1;
            dfs_b(u,now,count+1);
        }
    }
}
void dfs_w(int now,int pre,int count){
    if(pre==-1)w[now]=count;
    for(auto u:v[now]){
        if(u!=pre){
            w[u]=count+1;
            dfs_w(u,now,count+1);
        }
    }
}
int main(){
    cin >> n;
    for(int i=0;i<n-1;i++){
        int a,b;
        cin >> a >> b;
        v[a-1].push_back(b-1);
        v[b-1].push_back(a-1);
    }
    dfs_b(0,-1,0);
    dfs_w(n-1,-1,0);
    int bside=0;
    int wside=0;
    for(int i=0;i<n;i++){
        if(b[i]<=w[i])bside++;
        else wside++;
    }
    if(bside>wside)cout << "Fennec";
    else cout << "Snuke";
}

Measured memory_bytes: 16128
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn enum_all_pats(n: usize, cur: usize, tmp: &mut Vec<usize>) -> Vec<Vec<usize>>{

    if cur == n{
        return vec![tmp.clone()];
    }

    let mut res = enum_all_pats(n, cur+1, tmp);

    tmp.push(cur);
    res.append(&mut enum_all_pats(n, cur+1, tmp));
    tmp.pop();

    return res;
}

fn main(){
    let line = read_as_vec::<usize>();
    let (n, m, x) = (line[0], line[1], line[2]);
    let mut books: Vec<(usize, Vec<usize>)> = Vec::new();

    for _ in 0..n{
        let line = read_as_vec::<usize>();
        books.push((line[0], line.into_iter().skip(1).collect::<Vec<usize>>()));
    }

    let mut tmp = vec![];
    let pats: Vec<Vec<usize>> = enum_all_pats(n, 0, &mut tmp);

    let mut min_cost: usize = std::usize::MAX;
    for pat in pats{
        let mut cost = 0;
        let mut cmph = vec![0;m];
        for bi in pat{
            for i in 0..m{
                cmph[i] += (books[bi].1)[i];
            }
            cost += books[bi].0;
        }
        if cmph.iter().all(|a| *a >= x){
            min_cost = cmp::min(min_cost, cost);
        }
    }
    if min_cost == std::usize::MAX{
        println!("-1");
    }else{
        println!("{}", min_cost);
    }
}


Measured memory_bytes: 2604
import sys
input=lambda:sys.stdin.readline().rstrip()
from collections import deque

r=False
d=deque(list(input()))
for i in range(int(input())):
  Q=input().split()
  if Q[0]=='1':
    r=not r
  else:
    if (Q[1]=='1' and not r) or (Q[1]=='2' and r):
      d.appendleft(Q[2])
    else:
      d.append(Q[2])

if r:
  d.reverse()

print("".join(list(d)))


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

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rInt(a) scanf("%d",&a);

int matrix[102][11];

main(){
    int n; rInt(n);
    int arr[n], val;
    rep(i,n){
        int num = 0;
        for(int j=9;j>=0;--j){
            rInt(val);
            if(val) num |= (1<<j);
        }
        arr[i] = num;
    }

    rep(i,n) rep(j,11) rInt(matrix[i][j]);

    ll maxi = -10000000010;

    for(int i=1;i<(1<<10);++i){
        ll sum = 0;
        rep(j,n){
            int counter = 0;
            int number =  i & arr[j];
            rep(k,10) if(number & (1<<k)) counter++;
            sum += (ll) matrix[j][counter];
        }
        maxi = max(maxi,sum);
    }
    cout << maxi << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <limits>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <iomanip>
using namespace std;

#define FOR( i, m, n )	for( int (i) = (m); (i) < (n); i++ )
#define REP( i, n )		FOR( i, 0, n )
#define ALL( x )		(x).begin(), (x).end()

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

	vector<char> s(n);
	REP( i, n ) cin >> s[i];

	int count = 0;
	REP( i, n - 1 ) {
		if( s[i] == 'O' && s[i + 1] == 'X' ) {
			count++;
			i++;
		} else if( s[i] == 'X' && s[i + 1] == 'O' ) {
			count++;
			i++;
		}
	}

	cout << count << endl;

}


Measured memory_bytes: 3152
using System;

namespace ABC097_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Console.ReadLine();
            var A = int.Parse(N[0].ToString());
            var B = int.Parse(N[1].ToString());
            var C = int.Parse(N[2].ToString());
            var D = int.Parse(N[3].ToString());
            var s = "";
            if (A + B + C + D == 7) s = A +"+" + B + "+" + C + "+" + D + "=7";
            if (A - B + C + D == 7) s = A +"-" + B + "+" + C + "+" + D + "=7";
            if (A + B - C + D == 7) s = A +"+" + B + "-" + C + "+" + D + "=7";
            if (A + B + C - D == 7) s = A +"+" + B + "+" + C + "-" + D + "=7";
            if (A - B - C + D == 7) s = A +"-" + B + "-" + C + "+" + D + "=7";
            if (A - B + C - D == 7) s = A +"-" + B + "+" + C + "-" + D + "=7";
            if (A + B - C - D == 7) s = A +"+" + B + "-" + C + "-" + D + "=7";
            if (A - B - C - D == 7) s = A +"-" + B + "-" + C + "-" + D + "=7";
            Console.WriteLine(s);
        }
    }
}


Measured memory_bytes: 13140
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,no-stack-protector")
#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define LL long long int
#define vi vector<int>
#define vl vector<LL>
#define pb push_back
#define all(V) V.begin(),V.end()
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%I64d",&x)
#define pii pair<int,int>
#define cmax(a,b) ((a) = (a) > (b) ? (a) : (b))
#define cmin(a,b) ((a) = (a) < (b) ? (a) : (b))
#define debug(x)  cerr << #x << " = " << x << endl
function<void(void)> ____ = [](){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);};

void solve(){
    int n, l;
    vector<string> vec;
    cin >> n >> l;
    vec.resize(n);
    for(int i = 0; i < n; i++) cin >> vec[i];
    sort(all(vec));
    for(int i = 0; i < n; i++) cout << vec[i];
    cout << endl;
}
int main(){
    #ifndef ONLINE_JUDGE
    freopen("Local.in","r",stdin);
    freopen("ans.out","w",stdout);
    #endif
    solve();
    return 0;
}

Measured memory_bytes: 3644
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back
#define REP(i,a,b) for(int i=a; i<=b; i++)
#define MOD 1000000007

void solve(int test_case) {//209
	ll a;
	double b;
	cin>>a>>b;
	b*=100;
	ll c = (ll)round(b);
	cout<<(a*c)/100;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	//prefill();
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3716
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=(a);i<=(b);++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define ti3 tuple<int,int,int>
ll int MOD=998244353;
int INF=1e6;
 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");


main(){
    ll int a[7];
    rep(i,7){
        cin>>a[i];
    }
    ll int sum1=0,sum2=0;
    if(a[0]&&a[3]&&a[4]){
        sum1=3;
        a[0]--; a[3]--; a[4]--;
        sum1+=(a[0]/2)*2;
        sum1+=(a[3]/2)*2;
        sum1+=(a[4]/2)*2;
        sum1+=a[1];
    
    a[0]++; a[3]++; a[4]++;}
    sum2+=(a[0]/2)*2;
    sum2+=(a[3]/2)*2;
    sum2+=(a[4]/2)*2;
    sum2+=a[1];
    cout<<max(sum1,sum2);
    return 0;

}


Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int cou = 0;
			int ab = a+b;
			while(ab != 0){
				ab /= 10;
				cou++;
			}
			System.out.println(cou);
		}
	}
}



Measured memory_bytes: 26460
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int dp[100000+1];
ll min(ll a,ll b){
    if(a>b)
    return b;
    return a;
}
int knapsack(vector<ll> v,vector<ll> w,ll c,ll n){
     for(int i=0;i<n;i++){
         for(int j=100000;j>0;j--){
              if(j>=v[i]){
                  dp[j]=min(dp[j],w[i]+dp[j-v[i]]);
              }
         }
     }
     ll mx=INT_MIN;
     for(int i=0;i<=100000;i++){
         if(dp[i]<=c)
             mx=i;
         
     }
     return mx;
}
int main()
{
    IOS;
    ll n,c;
    cin>>n>>c;
    vector<ll>v(n,0);
    vector<ll>w(n,0);
    for(ll i=0;i<n;i++){
        cin>>w[i]>>v[i];
    }

    for(int i=0;i<=100000;i++)
    dp[i]=INT_MAX;

    dp[0]=0;
    cout<<knapsack(v,w,c,n)<<endl;
    return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"



int main() {
	int N; cin >> N;
	vector<ld>rs;
	vector<ld>xs;
	for (int i = 0; i < N; ++i) {
		int a; cin >> a;
		rs.push_back(a);
	}

	for (int i = 0; i < rs.size(); ++i) {
		ld nx = rs[i];
		for (int j = 0; j < i; ++j) {
			ld dis = sqrt((rs[i] + rs[j])*(rs[i] + rs[j]) - (rs[i] - rs[j])*(rs[i] - rs[j]));
			nx = max(nx, xs[j] + dis);
		}
		xs.push_back(nx);
	}
	ld ans = 0;
	for (int i = 0; i < rs.size(); ++i) {
		ans = max(ans,xs[i] + rs[i]);
	}

	cout << setprecision(22)<<fixed<<ans << endl;
	return 0;
}

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

public class Main {
	static final int MOD = (int)1e9+7;

	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		
		Set<Integer> set = new HashSet<Integer>();

		
		for(int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if(!set.add(a)) set.remove(a);
		}
		
		out.println(set.size());
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static long factorial(int n) {
		long a;

		if(n > 0) {
			a = n * factorial(n - 1);
		}else{
			a = 1;
		}

		return a;
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(K key, V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class UnionFind {
	int[] par;

	public UnionFind(int n) {
		par = new int[n];

		Arrays.fill(par, -1);
	}

	int root(int x) {
		if(par[x] < 0) return x;
		return par[x] = root(par[x]);
	}

	boolean unite(int x,int y) {
		x = root(x);
		y = root(y);

		if(x == y) return false;

		if(size(x) < size(y)) {
			int tmp = x;
			x = y;
			y = tmp;
		}

		par[x] += par[y];
		par[y] = x;

		return true;
	}

	boolean same(int x,int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}

	int size(int a) {
		return -par[root(a)];
	}
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



string s;
void solve(){
	cin >> s;
	int n = s.size();
	
	int cnt = 0;
	for(int i = 0; i < n; i++){
		cnt += s[i]-'0';
	}
	if(cnt % 9 == 0) cout << "Yes" << endl;
	else cout <<  "No" << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3708
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

template<typename T>
string to_string(const vector<T>& vc, int w) {
	if(vc.empty()) return "";
	if(w + 1 == vc.size()) return to_string(vc[w]);
	return to_string(vc[w]) + "," + to_string(vc, w + 1);
}

template<typename T>
string to_string(const vector<T>& vc) {
	return "{" + to_string(vc, 0) + "}";
}

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	int n;
	cin >> n;
	vector<int> arr(n);
	for(auto& el: arr) cin >> el;
	int ans = 0;
	for(int i = 0; i < n; i++) {
		if(i % 2 == 0 && arr[i] % 2) ans++;
	}
	cout << ans << '\n';
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
//#define endl '\n'
void trace(int n, int arr[]){for(int i = 0; i < n; i++){cout << i << " " << arr[i] << endl;} cout << endl << endl;}
string convertNumbToString(ll temp){
    string ans = "";
    while(temp){
        temp--;
        ans += ((temp % 26) + 'a');
        temp /= 26;
    }
    reverse(ans.begin(), ans.end());
    return ans;
}
int main()
{
    Hello
    ll a;
    cin >> a;
    cout << convertNumbToString(a);
    return 0;
}

Measured memory_bytes: 3588
//
// tested with : g++ (GCC) 8.3.0
//

#include <iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    int* A = new int[N];
    for (int i = 0; i < N; i++)
        cin >> A[i];

    bool flag = true;//全て偶数である。
    int count = 0;//操作回数。

    //全て偶数の可能性がある。
    while (flag == true) {
        //全て偶数を確認する。
        for (int i = 0; i < N; i++) {
            if ((A[i] % 2) != 0) {
                flag = false;//全て偶数ではない
                break;
            }
        }
        //全て偶数なら操作する。
        if (flag == true) {
            for (int i = 0; i < N; i++)
                A[i] = A[i] / 2;
            count++;
        }
    }

    cout << count << endl;

    return 0;
}


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


def g(x):
    return x * (x + 1) // 2


def main():
    import sys
    input = sys.stdin.readline

    n = int(input())
    ans = 0

    # See: https://www.youtube.com/watch?v=v8ppNGf49Nk&feature=youtu.be
    # KeyInsight:
    # ①約数⇄倍数と言い換え
    # 1の倍数: 1, 2, 3, 4, 5, 6, 7, 8, 9, ...
    # 2の倍数: 2, 4, 6, 8, ...
    # 3の倍数: 3, 6, ...
    # ...

    # ②1の倍数の和を基準に、等価な式変形を行う
    # 1の倍数の和は、g(x) = n * (n + 1) // 2
    # 2の倍数の和は、2 * (1, 2, 3, 4, ...)と考えることで、 2 * g(x / 2)
    # 以降、同様

    for i in range(1, n + 1):
        ans += i * g(n // i)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9028
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    
    int odd = 0;

    for(int i=1;i<=N;i++){
        if(i%2 == 1)
            odd++;
    }

    double ans = double(odd)/double(N);

    printf("%.10lf\n", ans);

}

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

int main(){
        int res = 0;
        string S,T;
        cin >> S >> T;
        for(int i = 0; i < 3; i++){
                if(S[i] == T[i]){
                        res++;
                }
        }
        cout << res << '\n';
        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
	int a;
	scanf("%d", &a);
	if ((a / 10) % 111 == 0) printf("Yes\n");
	else{
		if ((a % 1000) % 111 == 0) printf("Yes\n");
		else printf("No\n");
    }
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
using namespace std;
int h[100001];
int main(void)
{
	int n,mx=1000000001,flg=0,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
	}
	for(i=n-1;i>=0;i--){
		if(mx>=h[i]){
			mx=h[i];
		}
		else if(mx>=h[i]-1){
			mx=h[i]-1;
		}
		else{
			flg=1;
			break;
		}
	}
	if(flg==0){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


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

int main() {
    int n, a[100];
    cin >> n;
    for(int i=0;i<n;i++) cin >> a[i];
    cout << a[n-1];
    for(int i=1;i<n;i++) cout << " " << a[n-1-i];
    cout << endl;
    return 0;
}


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

typedef pair<int, int> P;

int main(){
    long long a, b, c, d;

    cin >> a >> b >> c >> d;

    long long num;

    num = a * c;
    num = max(num, a * d);
    num = max(num, b * c);
    num = max(num, b * d);

    cout << num << endl;

    return 0;
    
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))
#define MOD 998244353

typedef long long ll;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


ll dp[3005][3005];

int main(){
    vector<ll> tp(3010); tp[0] = 1;
    for(int i=1;i<3010;i++) tp[i] = (2 * tp[i-1]) % MOD;
    int n,s; cin >> n >> s;
    vector<int> v(n); 
    rep(i,n) cin >> v[i];
    rep(i,3005) dp[0][i] = 0;
    dp[0][0] = tp[n];
    for(int i=1; i < n+1;i++){
        int c= v[i-1];
        rep(j,s+1) dp[i][j] = dp[i-1][j];
        rep(j,s) if(j + c <= s) dp[i][j + c] = (dp[i][j + c] + ((dp[i-1][j] * modinv(2, MOD)) % MOD)) % MOD;
    }
    cout << dp[n][s] << endl;
    return 0;
}

Measured memory_bytes: 74120
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a / g * b;
}
#endif

ll f(ll x, ll c, ll d) {
    ll res = x;
    res -= x / c;
    res -= x / d;
    res += x / lcm(c, d);
    return res;
}

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

    ll A, B, C, D; cin >> A >> B >> C >> D;

    ll ans = f(B,C,D) - f(A-1,C,D);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

int main(){
    int a,b,m;
    int ans=inf;
    int mia=inf;
    int mib=inf;
    cin >> a >> b >> m;
    vector<int>A(a);
    vector<int>B(b);
    rep(i,a) {
        int aa;
        cin>> aa;
        A[i]=aa;
        mia=min(mia,aa);
    }

    rep(i,b) {
        int bb;
        cin >> bb;
        B[i]=bb;
        mib=min(mib,bb);
    }

    rep(i,m){
        int x,y,c;
        int price;
        cin >> x >> y >> c;
        price=A[x-1]+B[y-1]-c;
        ans=min(ans,price);
    }
    ans=min(ans,mia+mib);

    cout << ans <<endl;


    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

const int MAXN = 1000;
const int MAXM = 200000;

vector<int>G[MAXN + 5]; int to[MAXM + 5];
void addedge(int u, int i) {G[u].push_back(i);}

int tag[MAXN + 5], que[2*MAXN + 5];
bool ans1[MAXM + 5], ans2[MAXM + 5];

int n, m;
int main() {
	scanf("%d%d", &n, &m);
	for(int i=1;i<=m;i++) {
		int a; scanf("%d%d", &a, &to[i]);
		addedge(a, i);
	}
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=n;j++) tag[j] = 0;
		int s = 1, t = 0;
		for(int p=0;p<G[i].size();p++)
			tag[que[++t] = to[G[i][p]]] = G[i][p];
		while( s <= t ) {
			int x = que[s++], y = tag[x];
			for(int p=0;p<G[x].size();p++) {
				int q = to[G[x][p]];
				if( q != i ) {
					if( tag[q] != -1 ) {
						if( tag[q] == 0 )
							tag[que[++t] = q] = y;
						else if( tag[q] != y )
							tag[que[++t] = q] = -1;
					}
				}
				else ans1[G[x][p]] = 1;
			}
		}
		for(int p=0;p<G[i].size();p++)
			if( tag[to[G[i][p]]] == -1 ) ans2[G[i][p]] = 1;
	}
	for(int i=1;i<=m;i++)
		puts(ans1[i] ^ ans2[i] ? "diff" : "same");
}

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

int main()
{
	int a,b,c,d;

	cin >> a;

	b = a/3600;

	c = (a % 3600)/60;

	d = (a % 3600) % 60;

	cout << b << ':' << c << ':' << d << endl;

	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  int p,q,r;
  cin >> p >> q >> r;
  cout << min(p+q,min(p+r,q+r)) << endl;
  return 0;
}


Measured memory_bytes: 764
<?php
fscanf(STDIN, "%d %d", $h, $w);
for ($i = 0; $i < $h; $i++) {
	fscanf(STDIN, "%s", $s[]);
}
$dx = [[0, 1], [1, 0], [0, -1], [-1, 0]];
for ($i = 0; $i < $h; $i++) {
	for ($j = 0; $j < $w; $j++) {
		if ($s[$i][$j] == '#' && !isset($t[$i][$j])) {
			$f = 0;
			foreach ($dx as $d) {
				$x = $i + $d[0];
				$y = $j + $d[1];
				if (isset($s[$x][$y]) && $s[$x][$y] == '#') {
					$f = 1; $t[$x][$y] = 1; break;
				}
			}
			if (!$f) exit('No');
		}
	}
}
echo 'Yes';


Measured memory_bytes: 4856
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,m;
    cin>>n>>m;
    vec s(m);
    vector<char> c(m);
    rep(i,m) cin>>s[i]>>c[i];
    rep(i,1000){
        string t=to_string(i);
        if(t.size()!=n) continue;
        int ng=0;
        rep(j,m){
            if(t[s[j]-1]!=c[j]) ng++;
        }
        // debug(ng);
        if(ng==0){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template<typename Head> void dump(Head&& head) { cerr << head; dump(); }
template<typename Head, typename... Tail> void dump(Head&& head, Tail&&... tail) { cerr << head << ", "; dump(forward<Tail>(tail)...); }
#define debug(...) do {cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; dump(__VA_ARGS__); } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

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

  ll ans = inf;
  for (int i=1; i<n; i++) {
    ll a = i;
    ll b = n-i;
    ll tmp = 0;
    while (a > 0) {
      tmp += a%10;
      a /= 10;
    }
    while (b > 0) {
      tmp += b%10;
      b /= 10;
    }
    ans = min(ans, tmp);
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
    int N; cin >> N;
    vector<int> a(N), b(N), c(N - 1);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        a[i]--;
    }
for (int i = 0; i < N; i++)
    {
        cin >> b[i];
    }
    for (int i = 0; i < N-1; i++)
    {
        cin >> c[i];
    }

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans += b[a[i]];
        if(i > 0){
            if(a[i] == a[i-1] + 1){
                ans += c[a[i-1]];
            }
        }
    }

    cout << ans << 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 < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    int k, s;
    cin >> k >> s;

    int ans = 0;
    rep(x, k + 1)
    {
        rep(y, k + 1)
        {
            int z = s - x - y;
            if (0 <= z && z <= k)
            {
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;

#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())

using namespace std;

ll A,B,K;
int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> arr;
    cin >> A >> B >> K;
    ll count = 0;
    for(int i = 1;i <= A || i <= B; i++){
        if(A%i == 0 && B%i == 0){
            count++;
            arr.push_back(i);
        }
    }
    cout << arr[count-K] << 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)

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> check(N, 0);
    int pena = 0;
    int sei = 0;
    string ac = "AC";
    string wa = "WA";
    REP(i, M)
    {
        int p;
        string S;
        cin >> p >> S;
        if (check.at(p - 1) != -1)
        {
            if (S == wa)
            {
                ++check.at(p - 1);
            }
            else if (S == ac)
            {
                ++sei;
                pena += check.at(p - 1);
                check.at(p - 1) = -1;
            }
        }
    }

    std::cout << sei << " " << pena << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
#endif

	
		ll n,m,d;
		cin>>n>>m>>d;
		int count=0;
		for(int i=n;i<=m;i++)
		{
			if(i%d==0)
				count++;
		}
		cout<<count<<endl;
	
	return 0;
}

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

int main() {
  string w;
  cin >> w;
  bool ans = true;
  
  sort(w.begin(), w.end());
  
  if(w.size()%2 == 1) ans = false;
  
  else {
    for (int i=0; i < (w.size() - 1); i+=2) {
      if(w.at(i) == w.at(i+1)) {
        continue;
        }
      else {
        ans = false;
        break;
        }
      }
    }
  
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  }

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;



void solve(){

    string s;
    cin >> s;

    int cnt = 0;
    rep(i,0,3){
        if(s[i] == 'R'){
            if(!cnt) cnt = 1;
            if(i < 2 && s[i+1] == 'R'){
                ++cnt;
            }
        }
    }

    cout << cnt << "\n";

    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

    fast_io;
    int t=1;
    // cin >> t;

    while(t--){
        solve();
    }

    cpuTime();
return 0;
}


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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  long ans = 0;
  for (int i = 0; i < N; i++) {
    string s1 = S.substr(0, i);
    string s2 = S.substr(i + 1);
    reverse(s1.begin(), s1.end());
    int tmp = min(s1.size(), s2.size());
    if (S.at(i) == 'R') {
      int g1 = count(s1.begin(), s1.end(), 'G');
      int g2 = count(s2.begin(), s2.end(), 'G');
      int b1 = count(s1.begin(), s1.end(), 'B');
      int b2 = count(s2.begin(), s2.end(), 'B');
      int ng = 0;
      for (int j = 0; j < tmp; j++) {
        if (s1.at(j) == 'G' && s2.at(j) == 'B' || s1.at(j) == 'B' && s2.at(j) == 'G') ng++;
      }
      ans += (g1) * (b2);
      ans += (g2) * (b1);
      ans -= ng;
    }
    if (S.at(i) == 'G') {
      int r1 = count(s1.begin(), s1.end(), 'R');
      int r2 = count(s2.begin(), s2.end(), 'R');
      int b1 = count(s1.begin(), s1.end(), 'B');
      int b2 = count(s2.begin(), s2.end(), 'B');
      int ng = 0;
      for (int j = 0; j < tmp; j++) {
        if (s1.at(j) == 'R' && s2.at(j) == 'B' || s1.at(j) == 'B' && s2.at(j) == 'R') ng++;
      }
      ans += (r1) * (b2);
      ans += (r2) * (b1);
      ans -= ng;
    }
    if (S.at(i) == 'B') {
      int g1 = count(s1.begin(), s1.end(), 'G');
      int g2 = count(s2.begin(), s2.end(), 'G');
      int r1 = count(s1.begin(), s1.end(), 'R');
      int r2 = count(s2.begin(), s2.end(), 'R');
      int ng = 0;
      for (int j = 0; j < tmp; j++) {
        if (s1.at(j) == 'G' && s2.at(j) == 'R' || s1.at(j) == 'R' && s2.at(j) == 'G') ng++;
      }
      ans += (g1) * (r2);
      ans += (g2) * (r1);
      ans -= ng;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3676
#include<stdio.h>
int main(){
  int a,b,X,Y;
  
  scanf("%d",&X);
  scanf("%d",&Y);
  
  
 for(a=0;a <= X;a++){
  b = X-a;
   if(Y == 4*a + 2*b){
     printf("Yes");
     break;
   }else if(a==100 || a==X) {
     printf("No");
   }  
 }
   
   return 0;
 }
  


Measured memory_bytes: 2148
#include<stdio.h>
int main()
{
	int max,min,a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	max = a;
	min = a;
	if(b>max)max=b;
	if(c>max)max=c;
	if(b<min)min=b;
	if(c<min)min=c;
	if(1<=min && max<=100)printf("%d",max-min);
	return 0;
}

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


int main(){
  int n = 0;
  while(true){
    int sum =0;
    int push_n = 0;
    cin >> n;
    if(n == 0){
      break;
    }
    for(int i=0;i<(int)(n*(n-1)/2);i++){
      int a = 0;
      cin >> a;
      sum += a;
    }

    int x = sum / (n-1);
    cout << x << endl;

  }



  return 0;
}

Measured memory_bytes: 3000
h, n  = map(int, input().split())
a  = list(map(int, input().split()))
'''
n = input()
a = [int(input()) for i in range(n)]
'''
'''
n,m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
'''
# c = collections.Counter()
#-------------------------------#

if sum(a)>=h:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 13964
n, m, d = map(int, input().split())

floor = []
for _ in range(n):
    floor.append(list(input()))

cnt = 0
for i in range(n):
    for j in range(m):
        if floor[i][j] == ".":
            for k in range(1, d):
                if j+k >= m:
                    break
                elif floor[i][j+k] != ".":
                    break
            else:
                cnt += 1

            for k in range(1, d):
                if i+k >= n:
                    break
                elif floor[i+k][j] != ".":
                    break
            else:
                cnt += 1

print(cnt)



Measured memory_bytes: 5632