akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> P;

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define Rep(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える

const int INF = 10010;
;

int main() {
	int n, w; cin >> n >> w;
	vi value(n), weight(n);
	rep(i, n) cin >> value[i] >> weight[i];

	vector<vector<int>> dp(n+1, vector<int>(w+1, 0));


	rep(i, n) for (int j = 0; j <= w; j++) {
		//dp[i+1][j] := i番目でjを超えないvalueのmax和
		if (weight[i] <= j) dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - weight[i]] + value[i]);
		else dp[i + 1][j] = dp[i][j];
	}

	cout << dp[n][w] << endl;
}



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

int t1,t2;

int n,m;
set<int> g[100005];
vector<int> ans[100005];
bool vis[100005];

void dfs(int u,int p)
{
    if (vis[u]) return;
    vis[u]=1;
    while (!g[u].empty()) {
        int v=*g[u].begin();
        g[u].erase(v);
        g[v].erase(u);
        if (vis[v]) {
            ans[u].push_back(v);
        }
        else {
            dfs(v,u);
        }
    }
    if (p) {
        if (ans[u].size()&1) ans[u].push_back(p);
        else ans[p].push_back(u);
    }
}

int main()
{
    #ifdef NOT_DMOJ
    freopen("data.txt","r",stdin);
    #endif // NOT_DMOJ
    scanf("%d%d",&n,&m);
    if (m&1) {
        printf("-1\n");
        return 0;
    }
    while (m--) {
        scanf("%d%d",&t1,&t2);
        g[t1].insert(t2);
        g[t2].insert(t1);
    }
    dfs(1,0);
    for (int i=1; i<=n; i++) {
        for (int j:ans[i]) {
            printf("%d %d\n",i,j);
        }
    }
}


Measured memory_bytes: 22656
fun main() {
    val int = rint()
    function(int)
}

fun function(int: Int) {
    var sum = 0L
    for (i in 1..int) {
        if (i %3 != 0 && i %5 != 0) {
            sum += i
        }
    }
    println(sum)
}

fun rl() = readLine()!!
fun rsp() = readLine()!!.split(" ")
fun rint() = readLine()!!.toInt()
fun rspint() = readLine()!!.split(" ").map { it.toInt() }

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

using namespace std;
typedef long long ll;
const long long mod=1e9+7; //10^9+7


int main() {
    int n,x;
    int l[100000];
    cin >> n >> x;
    for(int i=0; i<n; i++){
      cin >> l[i];
    }
    int ans=0;
    int a = 0;
    for(int i=0; i<n; i++){
      if(a<=x){
          ans++;
      }
      a+=l[i];
    }
    if(a<=x){
        ans++;
    }
    cout << ans << endl;

  return 0;
}


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

int main(){
    int n,m,i,sum=0;
    cin>>n>>m;
    vector<int> a(n);
    rep(i,n) {
        cin>>a[i];
        sum+=a[i];
    }
    int count=0;
    int sle=sum/(4*m);
    if(sum%(4*m)!=0) sle++;
    rep(i,n) if(a[i]>=sle) count++;
    //cout<<sum<<endl;
    if(count>=m) {
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }


}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> h(N, 0), dp(N, 1000000000);
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }

  dp[0] = 0;
  for (int j = 1; j < N; j++) {
    for (int k = 1; k <= K; k++) {
      if (j - k < 0) {
        continue;
      }
      dp[j] = min(dp[j], abs(h[j] - h[j-k]) + dp[j-k]);
    }
  }

  cout << dp[N-1] << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

class List
{
public:
	List()
	{
		begin = (Node*)malloc(sizeof(Node));
		end = (Node*)malloc(sizeof(Node));
		begin->next = end;
		end->prev = begin;
	}
	~List()
	{
		//Node* n = begin->next;
		//while (n != end)
		//{
		//	Node* t = n;
		//	n = n->next;
		//	delete t;
		//}
		//delete begin;
		//delete end;
	}

	inline void insert(int x)
	{
		Node* n = (Node*)malloc(sizeof(Node));
		n->n = x;
		begin->next->prev = n;
		n->next = begin->next;
		n->prev = begin;
		begin->next = n;
	}

	inline void deleteFirst()
	{
		Node* n = begin->next;
		n->next->prev = n->prev;
		n->prev->next = n->next;
		//delete n;
	}

	inline void deleteLast()
	{
		Node* n = end->prev;
		n->next->prev = n->prev;
		n->prev->next = n->next;
		//delete n;
	}

	inline void del(int x)
	{
		Node* n = begin->next;
		while (n != end)
		{
			if (n->n != x)
			{
				n = n->next;
				continue;
			}

			n->prev->next = n->next;
			n->next->prev = n->prev;
			//delete n;
			break;
		}
	}

	void print()
	{
		Node* n = begin->next;
		while (n != end)
		{
			cout << n->n;
			n = n->next;
			if (n != end)
			{
				cout << " ";
			}
		}
		cout << endl;
	}
private:
	struct Node
	{
		int n;
		Node* next = NULL;
		Node* prev = NULL;
	};

	Node* begin;
	Node* end;
};

int main()
{
	List list;
	int n;
	cin >> n;
	string c;
	int k;
	REP(i, n)
	{
		cin >> c;
		if (c == "insert")
		{
			cin >> k;
			list.insert(k);
		}
		if (c == "delete")
		{
			cin >> k;
			list.del(k);
		}
		if (c == "deleteFirst")
		{
			list.deleteFirst();
		}
		if (c == "deleteLast")
		{
			list.deleteLast();
		}
		//list.print();
	}
	list.print();
	return 0;
}


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

int main(){
  int n;
  string s;
  cin>>n>>s;
  int kotae=0;
  for(int i=1;i<n-1;i++){
    int count=0;
    string a,b;
    a=s.substr(0,i);
    b=s.substr(i,n-i);
    //cout<<a<<" "<<b<<" ";
    map<char,int>mp;
    for(int j=-0;j<i;j++){
      mp[a[j]]=1;
    }
    for(int j=0;j<n-i;j++){
      if(mp[b[j]]==1){
        count++;
        mp[b[j]]++;
      }
    }
    //cout<<i<<" "<<count<<endl;
    kotae=max(kotae,count);
  }
  cout<<kotae<<endl;
  return 0;
}

Measured memory_bytes: 3616
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define dbgarrmint(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j].x<<" ";}cerr<<endl;}
#else
#define dbg(...)
#define dbgmap(...)
#define dbgarr(...)
#define dbgdp(...)
#define dbgmint(...)
#define dbgarrmint(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

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

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    Vec v(5);
    cin>>v;
    rep(i,5){
        if(v[i]==0){
            cout<<i+1<<endl;
        }
    }
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);
    solve();
}


Measured memory_bytes: 3612
#include <iostream>

using namespace std;

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int na = C / B + (int)(C % B != 0);
  int nt = A / D + (int)(A % D != 0);
  cout << (nt < na ? "No" : "Yes") << endl;
  return 0;
}

Measured memory_bytes: 3132
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 1e10;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    ll ans = 0;
    ll mini = Inf;
    ll sum = 0;
    vector<int> a(n), b(n);
    rep(i, n) {
      cin >> a[i];
      ans += a[i];
    }
    rep(i, n - 1) {
      ans -= a[i];
      sum += a[i];
      mini = min(mini, abs(sum - ans));
    }

    cout << mini << '\n';

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;



signed main(){
	//cout << fixed << setprecision(10);
	ll n; cin >> n;
	vl a(n);
	rep(i,0,n){
		cin >> a[i];
		a[i] -= (i+1);
	}
	sort(all(a));
	ll mid = a[n/2];
	ll ans = 0;
	rep(i,1,n+1){
		ans += abs(a[i-1] - mid);
	}
	cout << ans << endl;



	return 0;
}

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


void solve() {
  int A,B;
  cin >> A >> B;
   std::vector<int> arr(A, 0);
  rep(i,A) {
    scanf("%d", &arr[i]);
  }
  std::sort(arr.begin(), arr.end());
  int ans = 0;
  rep(i,B) {
    ans += arr[i];
  }
  cout << ans << "\n";
}

int main() {
  solve();
  return 0;
}


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

int ctoi(char c) {
    int n = c - '0';
    return n;
}

int pow_int(int x, int n) {
    if (n == 0) {
        return 1;
    }else {
        int y = x;
        for (int i = 0; i < n-1; i++) {
            x *= y;
        }
        return x;
    }
}


int main() {
    double l;
    cin >> l;
    double x = l/3;
    double ans = pow(x, 3);
    printf("%.10f\n", ans);
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N = int(input())
TA = []
for _ in range(N):
    TA.append(list(map(int, input().split())))

t0,a0 = 0,0
for i in range(N):
    t,a = TA[i]
    if t0 == t and a0 == a:
        pass
    else:
        if t0 > t or a0 > a:
            tmp = max([t0//t + min([1, t0 % t]), a0//a + min([1, a0 % a])])
            t0 = t*tmp
            a0 = a*tmp
        else:
            t0 = t
            a0 = a

print(t0+a0)



Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define s second
#define int long long
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define pb push_back

using namespace std;
const int N = 1e6 + 7;
const int INF = 1e9 + 7;
const int LOG = 20;
ll ans,a,b,cnt;
main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	cin >> a >> b;
    ans += 1;
    cnt += a;
    if(b == 1)
    {
        cout << 0;
        return 0;
    }
    while(cnt < b)
    {
        cnt += a;
        cnt--;
        ans++;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

#include <math.h>
#include <stdlib.h>


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

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
  int N;
  cin >> N;
  
  int ans = ((N-1) / 111) * 111 + 111; 
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import math
import numpy as np
A, B, H, M = list(map(int,input().split()))

h = (H+(M/60))*(math.pi/6)
m = M*math.pi/30

d = math.sqrt(((A*np.cos(h) - B*np.cos(m))**2)+((A*np.sin(h) - B*np.sin(m))**2))

print(d)

Measured memory_bytes: 27200
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;


public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String S = sc.next();
		char[] s = S.toCharArray();
		long ans = 0;
		long Rnum = 0;
		long Bnum = 0;
		long Gnum = 0;
		for(int i = 0; i < n; i++) {
			if(s[i] =='R') {
				Rnum++;
			}
			if(s[i] =='B') {
				Bnum++;
			}
			if(s[i] =='G') {
				Gnum++;
			}
		}
		ans+=Rnum*Bnum*Gnum;
		for(int i = 0; i < n; i++) {
			for(int j = i+1; j < n; j++) {
				int k = 2*j-i;
				if(k<n&&s[i]!=s[j]&&s[j]!=s[k]&&s[k]!=s[i]) {
					ans--;
				}
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 35928
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b,c,d,e,f=LI()
  ans=-inf
  ans_pair=[]
  lim=(100*e)/(100+e)
  for i in range(31):
    for j in range(31):
      for k in range(f//c+1):
        for l in range(f//d+1):
          mi=100*a*i+100*b*j
          sa=c*k+d*l
          s=mi+sa

          if s==0:
            continue

          if s>f:
            break

          noudo=(100*sa)/s
          if noudo>lim:
            break

          if ans<=noudo:
            ans=noudo
            ans_pair=[s,sa]

  return str(ans_pair[0])+' '+str(ans_pair[1])

# main()
print(main())


Measured memory_bytes: 5076
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl "\n"
#define ll long long
#define oo 0x3f3f3f3fLL
#define sz(s) (int)(s.size())
#define RT(s) return cout<<s,0
#define INF 0x3f3f3f3f3f3f3f3fLL
#define all(v) v.begin(),v.end()
#define watch(x) cout<<(#x)<<" = "<<x<<endl
const int dr[] { -1, -1, 0, 1, 1, 1, 0, -1 };
const int dc[] { 0, 1, 1, 1, 0, -1, -1, -1 };
#if __cplusplus >= 201402L
template<typename T>
vector<T> create(size_t n) {
	return vector<T>(n);
}
template<typename T, typename ... Args>
auto create(size_t n, Args ... args) {
	return vector<decltype(create<T>(args...))>(n, create<T>(args...));
}
#endif
void run() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#else
#endif
}

int main() {
	run();
	int a, b, m;
	cin >> a >> b >> m;
	vector<int> v1(a), v2(b);
	for (auto &it : v1)
		cin >> it;
	for (auto &it : v2)
		cin >> it;
	int mn = *min_element(all(v1)) + *min_element(all(v2));
	while (m--) {
		int x, y, c;
		cin >> x >> y >> c;
		mn = min(mn, v1[x - 1] + v2[y - 1] - c);
	}
	cout<< mn;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<cmath>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	
	int sum = 0;
	for (int i = 0; i <= b - a; ++i) {
		sum += i;
	}
	cout << sum - b << endl;
}

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

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

	cout << "Christmas";

	int cnt = abs(25 - D);
	for(int i=0; i<cnt; i++)
		cout << " Eve";
	cout << endl;

	return 0;
}


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

int main(){ //11-b-lucas Namber
  long long int n,l,x,y;
  cin >> n;
  x = 2;
  y = 1;
  l=1;
  for(int i=1; i<n; i++){
    if(n==1){
      l=1;
      break;
    }
    //cout << x << "," << y <<",";
    l+=x;
    x=y;
    y=l;
    //cout << l<< endl;
  }
  cout << l << endl;
}

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

int main() {
	int a[100][100] = { 0 };
	int b[100] = { 0 };
	int c[100] = { 0 };
	int x, y;
	
	cin >> x >> y;

	for (int i = 0; i < x; i++) {
		for (int j = 0; j < y; j++) {
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < y; i++) {
		cin >> b[i];
	}

	for (int i = 0; i < x; i++) {
		for (int j = 0; j < y; j++) {
			c[i] += a[i][j] * b[j];
		}
	}
	for (int i = 0; i < x; i++) {
		cout << c[i] << endl;
	}

	return 0;
}

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

int main() {

    int n{0};
    std::cin >> n;

    int k{0};
    std::cin >> k;
    int arr[n];
    for(int index = 0; index< n; ++index)
    {
        int val;
        std::cin >> val;
        arr[index] = val;
    }

    int dp[n];
    dp[0] = 0;

    for(int i = 1; i < std::min(n,k); ++i)
    {
        dp[i] = std::abs(arr[0] - arr[i]);
    }

    for(int i = k; i < n; ++i)
    {
        dp[i] = INT8_MAX;
    }
  
  if(n <= k)
    {
        std::cout << dp[n-1] << '\n';
        return 0;
    }

    for(int i = k; i < n; i++){
        dp[i] = dp[i - k] + abs(arr[i] - arr[i - k]);
        for(int j = k - 1; j > 0; j--){
            dp[i] = std::min(dp[i], dp[i - j] + abs(arr[i] - arr[i - j]));
        }
    }
  
    std::cout << dp[n-1];

    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.nextLine();
        char s = S.charAt(S.length() - 1);
        if (s == '2' || s == '4' || s == '5' || s == '7' || s == '9'){
            System.out.println("hon");
        } else if(s == '3'){
            System.out.println("bon");
        } else {
            System.out.println("pon");
        }

        scanner.close();
    }

}

Measured memory_bytes: 26868
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)

S = s()
N = len(S)-1
ans = 0
for bit in range(1<<N):
    B = [(bit>>i)&1 for i in range(N)]
    start = 0
    for i in range(N):
        if B[i] == 1:
            ans += int(S[start:i+1])
            start = i+1
    ans += int(S[start:N+1])
print(ans)


Measured memory_bytes: 77952
N = gets[0].to_i
A = gets.split(' ').map(&:to_i)
B = gets.split(' ').map(&:to_i)
C = gets.split(' ').map(&:to_i)
sum = 0
first_flag = true

for index in A do
  if (first_flag)
    last_index = index
    first_flag = false
  end
  if index - last_index == 1
    sum += C[last_index - 1]
  end
  last_index = index
end

puts sum + B.inject(:+)

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <regex>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int N,A[20],B[20],C[20];
  cin>>N;
  for (int i(0);i<N;i++) cin>>A[i];
  for (int i(0);i<N;i++) cin>>B[i];
  for (int i(0);i<N-1;i++) cin>>C[i];
  int cnt(0);
  for (int i(0);i<N;i++){
    cnt+=B[A[i]-1];
    if (i!=0&&A[i]==A[i-1]+1)cnt+=C[A[i]-2];
  }
  cout <<cnt << endl;
  return 0;
}


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

int main(){
  int N,P;
  string S;
  cin >> N;
  vector<pair<string, pair<int, int> > >table;
  for(int i=0;i<N;i++){
    cin >> S >> P;
    P = -P;
    table.push_back(make_pair(S,make_pair(P,i)));
  }
  sort(table.begin(),table.end());
  for(int i=0;i<N;i++){
    cout << 1+table[i].second.second<< endl;
  }
}


Measured memory_bytes: 3612
def f(A):
    x = A.values()
    c = x.index(max(x))
    return A.keys()[c]

s = raw_input().lower().split()
A={}
B={}
for w in s:
    if A.has_key(w): A[w] += 1
    else:
        A[w] = 1
        B[w] = len(w)
w1 = f(A)
w2 = f(B)
print w1, w2

Measured memory_bytes: 4212
#include<stdio.h>

int main(){
  int N, a[100000], push = 1, b[100000] = {0}, count = 0, i;
  
  scanf("%d", &N);
  for (i = 0; i < N; i++){
    scanf("%d", &a[i]);
  }
  while(1){
    if(b[push - 1] == 1){
      printf("-1\n");
      return 0;
    }
    b[push - 1] = 1;
    push = a[push - 1];
    count++;
    if(push == 2){
      printf("%d\n", count);
      return 0;
    }
  }
}

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

int main()
{
    int n;
    // scanf("%d", &x);
    cin >> n;
    // printf("%d\n", x * x * x);
    long ans = 0;
    rep(i, n)
    {
        int p = i + 1;
        if (p % 3 != 0 && p % 5 != 0)
        {
            // cout << p << endl;
            ans += p;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
hlist = []
wlist = []

while(1):
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break

    hlist.append(h)
    wlist.append(w)

for h, w in zip(hlist, wlist):
    for _ in range(w):
        print("#", end="")
    print()

    for i in range(1, h-1):
        print("#", end="")
        for j in range(1, w-1):
            print(".", end="")
        print("#", end="")
        print()

    for _ in range(w):
        print("#", end="")
    print()
    print()



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

const int N = 100005;

int n, a[N], f[N];
int B[N];
long long sB;
long long t;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i];
	for (int i = 0; i < n; ++i) f[i] = a[(i + 1) % n] - a[i];

	for (int i = 1; i < n; ++i) {
		int h = f[0] - f[i];
		if (h % n) return printf("NO\n"), 0;
		B[i] = h / n;
	}

	int mn = 0;
	for (int i = 0; i < n; ++i) sB += B[i], mn = min(mn, B[i]), t += 1LL * B[i] * i;

	long long b0 = (t + a[0] - sB * n);
	if (b0 % (1LL * n * (n + 1) / 2)) return printf("NO\n"), 0;
	b0 /= (1LL * (n + 1) * n / 2);

	if (b0 < 0) return printf("NO\n"), 0;
	printf("YES\n");
}

Measured memory_bytes: 1408
from numpy import*
from collections import*
class UNION_FIND(object):
    def __init__(self,n):
        #親の番号を格納する。親だった場合は-(その集合のサイズ)
        #作るときはParentの値を全て-1にする
        #こうすると全てバラバラになる
        self.parent=[-1 for i in range(n)]
        
    def root(self,x):
        #Aがどのグループに属しているか調べる
        if self.parent[x]<0:
            return x
        else:
            self.parent[x]=self.root(self.parent[x])  #親を再帰で探知 再帰は最後に上のifにひっかかる
            return self.parent[x]
 
    def size(self,x):
        #自分のいるグループの頂点数を調べる
        return -self.parent[self.root(x)]   #親をとってきたい
        
    def union(self,x,y):
        #AとBをくっ付ける
        #AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        #print(self.parent)
        x=self.root(x)
        y=self.root(y)
        #print(x,y)
        if x==y:   #すでにくっついてるからくっ付けない
            return False
            
        #大きい方(A)に小さいほう(B)をくっ付けたい
        #大小が逆だったらひっくり返しちゃう。
        if self.size(x)<self.size(y):
            x,y=y,x
        self.parent[x]+=self.parent[y]  #Aのサイズを更新する
        self.parent[y]=x   #Bの親をAに変更する
        return True


a,b=map(int,input().split())
*p,=map(int,input().split())
u=UNION_FIND(a)
d=defaultdict(list)

p=array(p)
for i in range(b):
    x,y=map(int,input().split())
    u.union(x-1,y-1)
for k,v in enumerate(u.root(i)for i in range(a)):
    d[v].append(k)
ans=0
for i in d.values():
    i=array(i)
    ans+=len(set(i+1)&set(p[i]))
print(ans)


Measured memory_bytes: 41276
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int , int>
#define fast ios_base::sync_with_stdio(0)
#define mod 1000000007
#define mx 200005
ll tree[mx*4] = {0};
int h[mx], arr[mx];
void update(int pos, int b, int e, int i, int j, ll val)
{
    if(b>e || b>j || e<i) return;
    if(b>=i && e<=j){
        tree[pos] = max(tree[pos], val);
        return;
    }
    int m = (b+e)/2;
    int l = pos*2;
    int r = l+1;
    update(l,b,m,i,j,val);
    update(r,m+1,e,i,j,val);
    tree[pos] = max(tree[l], tree[r]);
}
ll query(int pos, int b, int e, int i, int j)
{
    if(b>e || b>j || e<i) return 0;
    if(b>=i && e<=j)
        return tree[pos];
    int m = (b+e)/2;
    int l = pos*2;
    int r = l+1;
    return max(query(l,b,m,i,j), query(r,m+1,e,i,j));
}
int main()
{
    fast;
    int n;
    cin>>n;
    for(int i=1; i<=n; i++) cin>>h[i];
    for(int i=1; i<=n; i++) cin>>arr[i];
    for(int i=1; i<=n; i++){
        ll val = query(1,1,n,1,h[i]-1);
        update(1,1,n,h[i], h[i], val + arr[i]);
    }
    cout<<tree[1]<<endl;
}



Measured memory_bytes: 6400
my ($n) = split(/\s+/, <>);
my @r = ();

for my $i (0..($n-1)) {
    my ($s, $p) = split(/\s+/, <>);
    $r[$i]->{s} = $s;
    $r[$i]->{p} = $p;
    $r[$i]->{n} = $i+1;
}

@r = sort { $a->{s} cmp $b->{s} ||
		$b->{p} <=> $a->{p} } @r;

for (@r) {
    print $_->{n}, "\n";
}


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

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

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define pb push_back
#define nl cout<<"\n"
#define F first
#define S second
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

const ll MOD = 1000000007;
ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    int n;
    cin>>n;
    vector<int>x(n);
    ll cost = 0, sum = 0, sqsum = 0;
    for(int i=0;i<n;i++)
    {
        cin>>x[i];
        sum += x[i];
        sqsum += ( x[i] * x[i] );
    }

    ll mn = INF;
    for(int i=1;i<=100;i++)
    {
        ll now = sqsum + n*i*i - 2*sum*i;
        mn = min( mn, now );
    }
    cout<<mn,nl;


    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


Measured memory_bytes: 256
/* Akshat Sharma @akshat98 */
#include <iostream>
#include <bits/stdc++.h>
#define IOS  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define mp   make_pair
#define pb   push_back
#define F    first
#define S    second
#define ll   long long
#define MOD  1000000007
#define MAX  1000000001
#define vi   vector<int>
#define vl   vector<ll>
#define vpi  vector<pair<int,int> >
#define vpl  vector<pair<ll,ll> >
#define rep(i,a,b) for(i=a;i<b;i++)
#define reqp(i,a,b) for(i=a;i<=b;i++)
#define ren for(i=0;i<n;i++)
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef pair<int,int>pii;
typedef pair<ll,ll>pll;


int main()
{
	#ifndef ONLINE_JUDGE
	//freopen("input_file.txt", "r", stdin);
	//freopen("output_file.txt", "w", stdout);
	#endif
	int i,j,k,l,n,test_case,m,r;
	test_case=1;
	// cin>>test_case;
	while(test_case--){
		cin>>n>>i>>j;
		if(n*i<j){
			cout<<n*i<<"\n";
		}else cout<<j<<"\n";


	}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
using namespace std;

int main()
{

	int n, m, x, a[110], cnt;

    cin >> n >> m >> x;

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

    for(int i = 1; i < m + 1; i++){
        if(a[i] < x) cnt++;
    }

    cout << min(cnt, m - cnt) << endl;

	return 0;

}


Measured memory_bytes: 256
///not today

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

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef pair<long long, long long> pll;

#define SZ(x) (int)(x).size()
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define xmax(x, y) (x) = max((x), (y))
#define xmin(x, y) (x) = min((x), (y))
#define F first
#define S second
#define int long long
#define accept_sho ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#define lc (v << 1)
#define rc ((v << 1)| 1)
#define mid ((R + L) >> 1)

const int maxn = 1e5 + 5;
int cn[maxn], ans[maxn];
vector <int> v;

int32_t main(){
      accept_sho
      int n, Q;
      cin >>n >>Q;
      v.pub(n);
      for(int i = 0; i < Q; i ++){
            int x;
            cin >>x;
            while(SZ(v) && v.back() > x){
                  v.pob();
            }
            v.pub(x);
      }
      cn[SZ(v) - 1] = 1;
      while(SZ(v)){
            int x = v.back();
            while(x > v.front()){
                  int y = lower_bound(v.begin(), v.end(), x) - v.begin();
                  y --;
                  cn[y] += (x / v[y])* cn[SZ(v) - 1];
                  x %= v[y];
            }
            ans[x] += cn[SZ(v) - 1];
            v.pob();
      }
      for(int i = n; i > 0; i --){
            ans[i - 1] += ans[i];
      }
      for(int i = 1; i <= n; i ++){
            cout <<ans[i] <<' ';
      }
      return false;
}


Measured memory_bytes: 5732
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#define INT_INF 1000000000
#define DOUBLE_INF 1e18
#define MOD 1000000007
#define mod(x) ((x % MOD) + MOD) % MOD
#define MAX_N 200002

using namespace std;

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

ll frac[MAX_N];
void init_frac(ll N) {
  frac[0] = 1;
  for (ll i = 1; i <= N; i++) {
    frac[i] = mod(frac[i-1] * i);
  }
}

ll bit_pow(ll x, ll n) {
  ll res = 1;
  while (n > 0) {
    if ((n & 1) == 1) {
      res = mod(res * x);
    }
    x = mod(x * x);
    n >>= 1;
  }
  return res;
}

ll inverse(ll x) {
  return bit_pow(x, MOD-2);
}

ll sum(ll h, ll w) {
  return mod(frac[h-1+w-1] * inverse(mod(frac[h-1]*frac[w-1])));
}


int main()
{
  ll H, W, A, B;
  cin >> H >> W >> A >> B;
  init_frac(H+W);

  ll ans = 0;
  ans += sum(H, W);
  for (int i = 1; i <= B; i++) {
    ans = mod(ans - mod(sum(H-A, i) * sum(A, W-i+1)));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
A = input()
B = input()

ans = "EQUAL"

if len(A) == len(B):
    for a,b in zip(A,B):
        if a > b:
            ans = "GREATER"
            break
        elif a < b:
            ans = "LESS"
            break
        else:
            pass
elif len(A) > len(B):
    ans = "GREATER"
else:
    ans = "LESS"
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    long long int a,b,c;
    cin >> a >> b >> c;
    cout << min(a + b, min(b + c, c + a)) << endl;

    return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
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; }

template<typename T>
vector<T> gen_v(size_t a) { return vector<T>(a); }
template<typename T, typename ...Ts>
auto gen_v(size_t a, Ts... ts) { return vector<decltype(gen_v<T>(ts...))>(a, gen_v<T>(ts...)); }
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	for (string S; cin >> S && S != "$";) {
		int K; cin >> K;
		char cnt[128] = {};
		rep(i, 0, S.size()) {
			cnt[S[i]]++;
		}

		int ans = 0;
		if (cnt[S[0]] == S.size()) {
			ans = S.size() * K / 2;
		}
		else {
			vector<int> v;
			int t = 1;
			rep(i, 0, S.size() - 1) {
				if (S[i] == S[i + 1])
					t++;
				else {
					v.push_back(t);
					t = 1;
				}
			}
			v.push_back(t);

			rep(i, 0, v.size()) {
				ans += v[i] / 2 * K;
			}

			if (K >= 2 && S.front() == S.back()) {
				if (v.front() % 2 && v.back() % 2)
					ans += K - 1;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int N;
    int i, j, tmp;
    int flag = 1;
    int count = 0;

    scanf("%d",&N);
    int A[N];

    for(i = 0; i < N; i++){
        scanf("%d",&A[i]);
    }
    
    while (flag){
        flag = 0;
        for(j = N-1; j > 0; j--){
            if(A[j] < A[j-1]){
                tmp = A[j];
                A[j] = A[j-1];
                A[j-1] = tmp;
                flag = 1;
                count++;
            }
        }
    }
    
    for(j = 0; j < N; j++){
        if(N-1 == j){
            printf("%d\n",A[j]);
        }else{
            printf("%d ",A[j]);
        }
    }
    printf("%d\n",count);

    return 0;
}



Measured memory_bytes: 2104
// テ・ツ淞コテヲツ慊ャテ」ツδ?」ツδウテ」ツδ療」ツδャテ」ツδシテ」ツδ?

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int K, R, L;
double P, E, T;

double solve(int k, double lb, double ub, double q) {
    double mid = (ub + lb) / 2;
    double ret = 0.0;
    if(k == K) {
        if(T-E <= mid && mid <= T+E) return q;
        else return 0.0;
    }
    double a = T-E, b = T+E;
    if(mid < T) {
        // lb = mid
        // correct
        if(a <= mid && ub <= b) ret += q * (1-P);
        else if(!(b < mid || ub < a)) ret += solve(k+1, mid, ub, q*(1-P));

        // wrong
        if(a <= lb && mid <= b) ret += q * P;
        else if(!(b < lb || mid < a)) ret += solve(k+1, lb, mid, q*P);
    }
    else {
        // ub = mid
        // correct
        if(a <= lb && mid <= b) ret += q * (1-P);
        else if(!(b < lb || mid < a)) ret += solve(k+1, lb, mid, q*(1-P));

        // wrong
        if(a <= mid && ub <= b) ret += q * P;
        else if(!(b < mid || ub < a)) ret += solve(k+1, mid, ub, q*P);
    }
    return ret;
}

signed main() {
    cin >> K >> R >> L >> P >> E >> T;
    printf("%.12f\n", solve(0, R, L, 1.0));
    return 0;
}

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

typedef long long ll;
using namespace std;

int main(){
  ll N,i;
  ll A[111111];
  ll B[111111];
  cin >> N;
  ll ans = 0;
  for(i=0;i<=N;i++)
    cin >> A[i];
  for(i=0;i<=N-1;i++)
    cin >> B[i];
  for(i=0;i<=N-1;i++)
    ans += B[i];
  for(i=0;i<=N-1;i++){
    if(A[i]>B[i]) B[i] = 0;
    else{
      B[i] -= A[i];
      if(A[i+1] > B[i]){
        A[i+1] -= B[i];
        B[i] = 0;
      }
      if(A[i+1]<=B[i]){
        B[i] -= A[i+1];
        A[i+1] = 0;
      }
      ans -= B[i];
    }
    }
  cout << ans << endl;
}

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

int main ()
{
  string S;
  cin>>S;
  int ans;
  ans=0;
  if(S[0]==S[1]) ans=1;
  if(S[1]==S[2]) ans=1;
  if(S[2]==S[3]) ans=1;
  if(ans==1) cout<<"Bad"<<endl;
  else cout<<"Good"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define INF 1000000
int graph[101][101],n,c,d;

void warshall_floyd(){
  int i,j;
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
}

int min(int x,int y){
  return x<y?x:y;
}

int main(){
  int k,i,j,x,e,a,b;

  while(scanf("%d %d",&n,&k),n,k){

    for(i=0;i<=n;i++){
      for(j=0;j<=n;j++)
	graph[i][j]=INF;
      graph[i][i]=0;
    }
    for(i=0;i<k;i++){
      if(scanf("%d",&x),x){
	scanf("%d %d %d",&c,&d,&e);

	if(graph[c][d]>e){
	graph[c][d]=e;
	graph[d][c]=e;
	warshall_floyd();
	}
      }else{
	scanf("%d %d",&a,&b);
	printf(graph[a][b]>=INF?"-1\n":"%d\n",graph[a][b]);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    char c;
    cin >> c;
    cout << char(c+1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define name "test"
#define fi first
#define se second
#define ll long long
#define db double
#define pb push_back
#define wrln cout<<'\n';
#define ii pair<int,int>
#define li pair<long long,int>
#define iii pair<int,ii>

using namespace std;
const int N=2e5+100;
const int H=998244353;

ll n,res,dem,sum,k;
ll f[N],d[N];

vector <ii> v;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    if ( fopen(name".inp","r") )
    {
        freopen(name".inp","r",stdin);
        freopen(name".out","w",stdout);
    }
    cin>>n>>k;
    for (int i=1; i<=k; i++)
    {
        int l,r;
        cin>>l>>r;
        v.pb({l,r});
    }

    f[1]=1; d[1]=1;
    f[0]=0; d[0]=0;

    for (int i=2; i<=n; i++)
    {
        for (auto j:v)
        {
            int x=max(0,i-j.fi);
            int y=max(0,i-j.se-1);

            f[i]=(f[i]+d[x]-d[y] +H ) % H;
        }
        d[i]=( d[i-1]+f[i]) % H ;
    }
    cout<<f[n];
}


Measured memory_bytes: 6760
import bisect
N = int(input())

import math
P = [2]
for k in range(3,100010):
    f = 1
    for l in range(2,int(math.sqrt(k))+1):
        if k % l == 0:
            f = 0
            break
    if f==1:
        P.append(k)

print(P[bisect.bisect_left(P,N)])


Measured memory_bytes: 42988
from fractions import gcd
from itertools import accumulate

n = int(input())
a = list(map(int, input().split()))
a = [0] + a + [0]

l = list(accumulate(a, gcd))
r = list(reversed(list(accumulate(reversed(a), gcd))))

ans = max(gcd(li, ri) for li, ri in zip(l[:-2], r[2:]))

print(ans)


Measured memory_bytes: 16104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)


int main(){
  string s;
  int N,i,max=0,temp=0; cin >> N >> s;
  rep(i, N){
    if(s[i] == 'I') temp++;
    else temp--;
    if(max < temp) max = temp;
  }
  cout << max << endl;
}

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

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

int main() {
        int n, l;
        cin >> n >> l;
        vector<int> a(n);
        for (int i = 0; i < n; i ++) cin >> a[i];
        int ma = -1;
        int index;
        for (int i = 0; i < n - 1; i ++) {
                if (ma < a[i] + a[i + 1]) {
                        ma = a[i] + a[i + 1];
                        index = i;
                }
        }
        if (ma < l) {
                cout << "Impossible" << endl;
                return 0;
        }
        cout << "Possible" << endl;
        for (int i = 0; i < index; i ++) cout << i + 1 << endl;
        for (int i = n - 2; i > index; i --) cout << i + 1 << endl;
        cout << index + 1 << endl;
        return 0;
}



Measured memory_bytes: 1152
// Problem : A - αlphabet
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define debug(x) cerr << #x << " = " << x << '\n'
#define debug_arr(a , n) for(int i = 0 ; i < n ; i++)cerr << a[i] << " "
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll> 
#define all(x) (x).begin() , (x).end()
#define inf 1000000000
#define mod 1000000007

const int max_n = 1e5 + 9;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
int main()
{
    char c;
    cin >> c;
    
    if(c >= 'A' && c <= 'Z')cout << 
    'A';
    else
    cout << 'a';
    return 0;
}

Measured memory_bytes: 3608
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int a_price = Integer.parseInt(sc.next());
        int b_price = Integer.parseInt(sc.next());
        int merge_price = Integer.parseInt(sc.next());
        int n_a = Integer.parseInt(sc.next());
        int n_b = Integer.parseInt(sc.next());
        //String s = sc.next();
        if(a_price+b_price > merge_price*2){
            if(n_a>n_b){
                if(a_price>merge_price*2){
                    System.out.println(merge_price*n_a*2);
                }else{
                    System.out.println(merge_price*n_b*2+(n_a-n_b)*a_price);
                }
            }else{
                if(b_price>merge_price*2){
                    System.out.println(merge_price*n_b*2);
                }else{
                    System.out.println(merge_price*n_a*2+(n_b-n_a)*b_price);
                }
            }
        } else {
            System.out.println(a_price*n_a + b_price*n_b);
        }
    }
}

Measured memory_bytes: 22612