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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  vector<int> p(n);
  for(int i = 0; i < n; i++) {
    cin >> s.at(i) >> p.at(i);
  }
  
  vector<pair<string, int>> num(n);
  string ban;
  for(int i = 0; i < n; i++) {
    ban = 100 - p.at(i);
    num.at(i).first = s.at(i) + ban;
    num.at(i).second = i;
  }
  sort(num.begin(), num.end());
  
  for(int i = 0; i < n; i++) {
    cout << num.at(i).second + 1 << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value


void solve() {

	int N, L;
	cin >> N >> L;
	int a[210];

	int min_i = 0;
	int min = 1000;
	for (int i = 0; i < N; i++) {
		a[i] = L + i;
		if (min > abs(a[i])) {
			min = abs(a[i]);
			min_i = i;
		}
 	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		if (i == min_i) continue;
		ans += a[i];
	}

	cout << ans << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
#include <cstring>
#include <numeric>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define repll(i,n) for(long long int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
template <typename T_char>
char ToUpper (char cX) { return toupper(cX); }
//g++ -std=c++1z temp.cpp
//./a.exe
ll digit(ll a){
    ll count = 0;
    for (ll i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }
    }
    return count;
}
//桁数のカウント
//pow(x,n) == x^n
//sum = accumulate(v.begin(),v.end(),0);
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a,   b) * b;}



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

int n;
cin >> n;
if(n % 2 == 0) cout << n/2 << endl;
else cout << n/2+1 << endl;




//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
def connect(n,k,ans,edge_list):
	for u in range(1,n):
		for v in range(u+1,n):
			if k==ans:
				return
			else:
				edge_list.append((u,v))
				ans -= 1

def solve(n,k):
	edge_list = []
	ans = 0

	for u in range(1,n):
		ans += len(edge_list)
		edge_list.append((u,n))

	if k > ans:
		print(-1)
		return

	connect(n,k,ans,edge_list)
	print(len(edge_list))
	for edge in edge_list:
		print(*edge)

solve(*map(int,input().split()))

Measured memory_bytes: 74560
#include "bits/stdc++.h"

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

using i64 = long long;
using d64 = long double;
using pi = pair<int, int>;
using pli = pair<i64, i64>;
using ti = tuple<int, int, int>;
using tli = tuple<i64, i64, i64>;

#define iterall(cont) cont.begin(), cont.end()
#define prec(n) setprecision(n) << fixed

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

    string s;
    cin>>s;

    int x;
    if(s=="RRR") x = 3;
    else if(s=="RRS" || s=="SRR") x = 2;
    else if(s=="SSS") x = 0;
    else x = 1;

    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 3644
A, B, C = map(int, input().split())
K = int(input())

count = 0
while not A < B:
  B *= 2
  count += 1
while not B < C:
  C *= 2
  count += 1

if count <= K and A < B < C:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 9168
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

const int MAX_N = 1 << 17;

int n;
// セグメント木を持つグローバル配列
int dat[2 * MAX_N - 1];

void init(int n_) {
  // 簡単のため、要素数を2のべき乗に
  n = 1;
  while (n < n_) {
    n *= 2;
  }

  // すべての値をINT_MAXに
  for (int i = 0; i < 2 * n - 1; ++i) {
    dat[i] = INT_MAX;
  }
}

// k番目の値(0-indexed)をaに変更
void update(int k, int a) {
  // 葉の節点
  k += n - 1;
  dat[k] = a;
  // 登りながら更新
  while (k > 0) {
    k = (k - 1) / 2;
    dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
  }
}

// [a, b)の最小値を求める
// 後ろの方の引数は、計算の簡単のための引数。
// kは節点の番号、l、rはその節点が(l, r)に対応づいていることを表す。
// したがって、外からはquery(a, b, 0, 0, n)として呼ぶ。
int query(int a, int b, int k, int l, int r) {
  // [a, b)と(l, r)が交差しなければ、INT_MAX
  if (r <= a || b <= l) {
    return INT_MAX;
  }

  // [a, b)が(l, r)を完全に含んでいれば、この節点の値
  if (a <= l && r <= b) {
    return dat[k];
  } else {
    // そうでなければ、2つの子の最小値
    int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return min(vl, vr);
  }
}

int find(int a, int b) { return query(a, b + 1, 0, 0, n); }

int main() {
  int n;
  int q;
  cin >> n >> q;
  init(n);
  REP(i, q) {
    int com;
    int x;
    int y;
    cin >> com >> x >> y;
    if (com == 0) {
      update(x, y);
    } else {
      std::cout << find(x, y) << std::endl;
    }
  }
  return 0;
}



Measured memory_bytes: 4028
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define x first
#define y second

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

const int N=2010;
const int mod=1000000007;
const int inv2=(mod+1)/2;

vi e[2010];

int dp[2010][2010][3],size[2010];
int fac[2010],pow2[2010];

template <class T>
void read(T &x)
{
	char ch;
	for (ch=getchar();(ch<'0'||ch>'9')&&ch!='-';) ch=getchar();
	x=0;int t=1;if (ch=='-') {ch=getchar();t=-1;}
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	x*=t;
}

void dfs(int k)
{
	dp[k][1][0]=1;size[k]=1;
	for (vi::iterator p=e[k].begin();p!=e[k].end();p++)
	{
		dfs(*p);
		for (int j=size[k];j;j--)
			for (int x=2;x>=0;x--)
			{
				for (int l=1;l<=size[*p];l++)
				{
					if (x<2)
						for (int y=0;y<2;y++)
							dp[k][j+l-1][x+1]=(ll(dp[k][j][x])*dp[*p][l][y]+dp[k][j+l-1][x+1])%mod;
					for (int y=0;y<=2;y++)
					{
							dp[k][j+l][x]=(ll(dp[k][j][x])*dp[*p][l][y]%mod*(y==0 ? inv2 : 1)+dp[k][j+l][x])%mod;
							//if (k==2) printf("%d %d %d %d %d\n",dp[2][2][0],j,x,l,y);
					}
				}
				dp[k][j][x]=0;
			}
		size[k]+=size[*p];
	}
}

int main()
{
	#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
	#endif
	int n;scanf("%d",&n);
	for (int i=2;i<=n;i++)
	{
		int x;scanf("%d",&x);e[x].pb(i);
	}
	memset(dp,0,sizeof(dp));
	dfs(1);
	fac[0]=1;for (int i=1;i<=n;i++) fac[i]=ll(fac[i-1])*i%mod;
	pow2[0]=1;for (int i=1;i<=n;i++) pow2[i]=pow2[i-1]*2%mod;
	int ans=0;//printf("%d\n",dp[2][2][0]);
	for (int i=1;i<=n;i++)
		for (int j=0;j<=2;j++)
		{
			int t=ll(fac[i])*pow2[i]%mod*dp[1][i][j]%mod*(j==0 ? inv2 : 1)%mod;
			//printf("%d %d %d %d\n",i,j,t,dp[1][i][j]);
			if ((n-i)&1) ans=(ans-t+mod)%mod; else ans=(ans+t)%mod;
		}
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 48000
#include <iostream>
#include <cmath>
#include <vector>

int main() {
	int N;

	std::cin >> N;
	std::vector<std::uint64_t> primes(N, 0);

	for (int i = 2; i <= N; ++i) {
		int k = i;

		for (int j = 2; j <= std::sqrt(k); ++j) {
			while (k % j == 0) {
				++primes[j - 1];
				k /= j;
			}
		}

		if (k > 1) ++primes[k - 1];
	}

	std::uint64_t ans = 1;
	std::uint64_t mod = static_cast<std::uint64_t>(std::pow(10, 9) + 7);

	for (int i = 0; i < N; ++i) {
		ans = (ans * (primes[i] + 1)) % mod;
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat May  2 21:39:51 JST 2020
 **/

signed main() {
    Int x;
    std::cin >> x;
    __int128_t cur = 100;
    Int ans = 0;
    while (cur < x) {
        ans++;
        cur = cur * 101 / 100;
    }
    std::cout << ans << std::endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()

int N;
string S;
set<int> ok1, ok2, ok3;

int solve() {
    REP (i, N) {
        int n = S[i] - '0';
        for (auto iter = ok2.begin(); iter != ok2.end(); iter++) {
            ok3.insert((*iter) * 10 + n);
        }
        for (auto iter = ok1.begin(); iter != ok1.end(); iter++) {
            ok2.insert((*iter) * 10 + n);
        }
        ok1.insert(n);
    }
    return ok3.size();
}

int main() {
    cin >> N >> S;
    cout << solve() << endl;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  if (s == "AAA" or s == "BBB") {
    cout << "No\n";
  } else {
    cout << "Yes\n";
  }
}


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

int func(int x) {
  if (x % 100 != 0) return 0;
  return func(x / 100) + 1;
}

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

  int cnt=0;
  for (int i=1;;i++) {
    if (func(i)==D) {
      cnt++;
      if (cnt==N) {
        cout << i << endl;
        return 0;
      }
    }
  }
}

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

int a,b;

int main(){
	scanf("%d %d",&a,&b);
	int m=max(a,b);
	int flag=0;
	for(int i=0;i<=m;i++){
		int a1,b1;
		if(a<i){
			a1=i-a;
		}else{
			a1=a-i;
		}
		if(b<i){
			b1=i-b;
		}else{
			b1=b-i;
		}
		if(a1==b1){
			printf("%d\n",i);flag=1;break;
		}
	}
	if(flag==0) printf("IMPOSSIBLE\n");
}

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

int main()
{
    ll n,flag=0;
    cin >> n;
    vector<P> d;
    rep(i, n)
    {
        ll d1, d2;
        cin >> d1 >> d2;
        d.push_back(P(d1, d2));
    }

    rep(i,n-2){
        if(d[i].first!=d[i].second)continue;
        if(d[i+1].first!=d[i+1].second)continue;
        if(d[i+2].first!=d[i+2].second)continue;
        flag=1;
    }

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


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

int main()
{
    string S, T;
    cin >> S >> T;
    bool flag =false;

    
    for(size_t i = 0; i < S.length(); i++)
    {
        char buf;
        buf = S.front();
        S.erase(0,1);
        S.push_back(buf);
        if(S == T) flag = true;
    }
    
    
    if (flag) {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 888
import numpy as np

n, m = map(int, input().split())
a = np.array([list(input()) for _ in range(n)])
b = np.array([list(input()) for _ in range(m)])

# print(a, b)

flag = False

for i in range(n - m + 1):
    for j in range(n - m + 1):
        mat = a[i : i + m, j : j + m]
        # print(mat.shape)
        if (mat == b).all():
            flag = True

print("Yes" if flag else "No")



Measured memory_bytes: 12440
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    ll n;
    int z = 0;
    cin >> n;
    for (ll i = 1; i * i <= n - 1; i++) if ((n - 1) % i == 0) {
        if (i > 1) z++;
        if (i * i != n - 1) z++;
    }
    for (ll i = 1; i * i <= n; i++) if (n % i == 0) {
        if (i > 1) {
            ll j = n;
            while (j % i == 0) j /= i;
            if (j % i == 1) z++;
        }
        if (i * i != n) {
            ll j = n;
            while (j % (n / i) == 0) j /= (n / i);
            if (j % (n / i) == 1) z++;
        }
    }
    cout << z;
}


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

using namespace std;

int main()
{
    int A, B;
    cin >> A >> B;
    for (int C = 1; C <= 3; ++C)
    {
        if (A*B*C % 2 == 1)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::pair;

using std::vector;
using std::sort;

int main(){
    int a,b;
    cin >> a >> b;
    int n=std::min(a,b);
    cout << std::max(n,a-1) << endl;
    return 0;
}



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

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

Measured memory_bytes: 3596
using System;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var min = int.MaxValue;
        var max = int.MinValue;
        var s = Console.ReadLine().Split(' ');
        for (int i = 0; i < n; i++)
        {
            var ai = int.Parse(s[i]);
            min = Math.Min(min, ai);
            max = Math.Max(max, ai);
        }
        Console.WriteLine(Math.Abs(max - min));
    }
}


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

int main(){
    string s;
    cin >> s;
    
    char temp=s[0];
    string flag="Good";
    for(int i=1;i<s.size();i++){
        if(temp==s[i]){
            flag="Bad";
            break;
        }
        temp=s[i];
    }
    cout << flag << endl;
    return 0;
}

Measured memory_bytes: 256
// not solved by myself
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        long X = sc.nextLong();
        long Y = sc.nextLong();

        long count = 1;
        long tmp = X;

        while(true){
            tmp *= 2;
            if(tmp <= Y)
                count++;
            else
                break;
        }

        System.out.println(count);



    }

     public static long max(int[] ar,int size){
        long max = 0;
        for(int i = 0; i< size;i++)
            if(max < ar[i])
                max = ar[i];
        return max;
    }


    public static long max(List<Long> ar){
        long max = 0;
        for(int i = 0; i< ar.size();i++)
            if(max < ar.get(i))
                max = ar.get(i);
        return max;
    }

    public static Integer min(List<Integer> ar){
        int min = 10000;
        int index = 0;
        for(int i = 0; i< ar.size();i++){
            if(min > ar.get(i)){
                min = ar.get(i);
                index = i;
            }
        }
        return min;
    }


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

}





Measured memory_bytes: 23892
#include <iostream>
using namespace std;
//
// Created by karayuu on 2018-12-19.
//
int main() {
    int a, b;
    cin >> a >> b;

    if (a < b) {
        cout << "a < b" << endl;
    } else if (a == b) {
        cout << "a == b" << endl;
    } else {
        cout << "a > b" << endl;
    }
}


Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;

int R, C, N, X[200000], Y[200000];

pii frame(int x, int y) {
  if(x == 0) return pii(0, y);
  if(y == C) return pii(1, x);
  if(x == R) return pii(2, R - y);
  if(y == 0) return pii(3, C - x);
  return pii(-1, -1);
}

int main(void) {
  cin >> R >> C >> N;
  REP(i, 0, N) cin >> X[i * 2] >> Y[i * 2] >> X[i * 2 + 1] >> Y[i * 2 + 1];

  vector<ppi> v;
  REP(i, 0, N) {
    pii p = frame(X[i * 2], Y[i * 2]);
    pii q = frame(X[i * 2 + 1], Y[i * 2 + 1]);
    if(p != pii(-1, -1) && q != pii(-1, -1)) {
      v.push_back(ppi(p, i));
      v.push_back(ppi(q, i));
    }
  }

  sort(v.begin(), v.end());

  stack<int> stk;
  REP(i, 0, v.size()) {
    if(stk.size() > 0 && stk.top() == v[i].se) stk.pop();
    else stk.push(v[i].se);
  }
  if(stk.size() == 0) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 6516
//ABC112B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include<stdio.h>
using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	int num = 1;
	int count =0;
	while(num < b){
		num +=a-1;
		count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())
Y2 = Y // 1000
mod5 = Y2 % 5
div5 = Y2 // 5
for c_div5 in range(div5 + 1):
    c = c_div5 * 5 + mod5
    a = (Y2 - c) // 5 - (N - c)
    b = N - a - c
    if a >= 0 and b >= 0: break
    if c_div5 == div5: a=-1;b=-1;c=-1
print(a, b, c)

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

#define MOD ((int)(1e9 + 7))

using namespace std;

int main() {
	int N, M;

	cin >> N >> M;
	vector<bool> broken(N + 1, false);
	vector<int> DP(N + 1, 0);
	for (int i = 0; i < M; i++)
	{
		int a;
		cin >> a;
		broken[a] = true;
	}

	DP[0] = 1;
	if (!broken[1]) DP[1] = 1;
	for (int i = 2; i <= N; i++)
	{
		if (broken[i]) continue;
		DP[i] = (DP[i - 1] + DP[i - 2])%MOD;
	}

	cout << DP[N] << endl;

	return 0;
}

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

typedef long long ll;
typedef pair<int, int> pi;
#define F first
#define S second
#define PB push_back

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

const int MOD = 1000000007;

// int max = *std::max_element(vec.begin(), vec.end());
// int sum = accumulate(list, list + size, 0);

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    string s; cin >> s;
    
    int pass = 0;
    int b_pass = 0;
    
    for (int i = 0; i < n; i++) {
        int prize = i + 1;
        if (s[i] == 'a') {
            if (pass < a + b) {
                cout << "Yes" << endl;
                pass++;
            } else {
                cout << "No" << endl;
            }
        } else if (s[i] == 'b') {
            if (pass < a + b && b_pass < b) {
                cout << "Yes" << endl;
                b_pass++;
                pass++;
            } else {
                cout << "No" << endl;
            }
        } else if (s[i] == 'c') {
            cout << "No" << endl;
        }
    } 
}


Measured memory_bytes: 896
N,M=map(int,input().split())

li=[]
while True:
    try:
        li.append(list(map(int,input().split())))

    except:
        break;
      
li.sort()

#print(li[0][1]*li[0][0])

ans=0
for i in range(N):
  if li[i][1]<M:
    M=M-li[i][1]
    #print(M)
    ans=ans+li[i][0]*li[i][1]
    #print(ans)
  else:
    ans=ans+li[i][0]*M
    break
    
print(ans)

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

using namespace std;

// typedef long long ll;
typedef int ll;
#define MAX INT_MAX
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

typedef vector<ll> vec;
typedef vector<vec> mat;
#define CREATE_MATRIX(n,m) vector<vec>(n,vec(m,0ll))

mat mul(mat &a,mat &b,ll md=MAX,ll clamp=MAX){
  if(a.size()==0 || b.size()==0) assert(false&&"ERROR: ????????????????????????????????????");
  // a(n*l) * b(l*m)
  int n = a.size();
  int l = a[0].size();
  int m = b[0].size();
  if(b.size()!=l) assert(false&&"ERROR: ????????????????????????????????????");
  mat ret = CREATE_MATRIX(n,m);
  REP(i,n)REP(j,m){
    REP(k,l){
      ret[i][j] += a[i][k] * b[k][j] % md;
      if(ret[i][j]>=clamp-1)break;
      ret[i][j] %= md;
    }
    ret[i][j] %= clamp;
  }
  return ret;
}

void out_mat(mat a){
  REP(i,a.size()){
    REP(j,a[i].size())cout<<a[i][j]<<" ";
    cout<<endl;
  }
}
void out_vec(mat v){
  assert(v[0].size()==1);
  REP(i,v.size())cout<<v[i][0]<<" ";
  cout<<endl;
}

int main(){
  // verify: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2107
  while(true){
    int n,m;
    ll z;
    cin>>n>>m>>z;
    if(!n && !m && !z)break;
    vector<pii> es(m);
    REP(i,m){
      int x,y;
      cin>>x>>y;
      es[i].first = x-1;
      es[i].second = y-1;
    }
    mat M = CREATE_MATRIX(2*m,2*m);
    REP(i,m)REP(j,m){
      if(i==j)continue;
      if(es[i].second == es[j].first) M[j][i] = M[m+i][m+j] = 1;
      if(es[i].first == es[j].second) M[i][j] = M[m+j][m+i] = 1;
      if(es[i].first == es[j].first) M[j][m+i] = M[i][m+j] = 1;
      if(es[i].second == es[j].second) M[m+j][i] = M[m+i][j] = 1;
    }
    mat X = CREATE_MATRIX(2*m,1);
    REP(i,m)if(es[i].first == 0)X[i][0]=1;
    REP(i,m)if(es[i].second == 0)X[m+i][0]=1;
    --z;
    mat ans = CREATE_MATRIX(2*m,2*m);
    REP(i,2*m)ans[i][i] = 1;
    while(z){
      if(z&1) ans = mul(ans,M,MAX,2);
      M = mul(M,M,MAX,2);
      z>>=1;
    }
    ans = mul(ans,X,MAX,2);
    bool flag = false;
    REP(i,m){
      if(es[i].second == n-1 && ans[i][0]>=1){
        flag = true;
        break;
      }else if(es[i].first == n-1 && ans[i+m][0]>=1){
        flag = true;
        break;
      }
    }
    if(flag)cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1348
#include <bits/stdc++.h>
 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define li long long
#define itn int
 
using namespace std;
 
inline int nxt(){
	int n;
	scanf("%d", &n);
	return n;
}

template <typename T>
ostream& operator <<(ostream& ostr, const vector<T>& a) {
	ostr << "(";
	for (size_t i = 0; i < a.size(); ++i) {
		if (i) {
			ostr << ", ";
		}
		ostr << a[i];
	}
	ostr << ")";
	return ostr;
}

const int mod = 1000000007;

long long pw(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1ll) {
			res = res * a % mod;
		}
		b >>= 1;
		a = a * a % mod;
	}
	return res;
}

int main() {
	int n = nxt(), m = nxt(), q = nxt();
	vector<string> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}

	vector<vector<int>> hor(n, vector<int>(m, 0));
	vector<vector<int>> ver(n, vector<int>(m, 0));

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			if (i < n - 1) {
				ver[i][j] = (a[i][j] == '1' && a[i + 1][j] == '1');
			}
			if (j < m - 1) {
				hor[i][j] = (a[i][j] == '1' && a[i][j + 1] == '1');
			}
		}
	}

	vector<vector<int>> pref_sum(n + 1, vector<int>(m + 1, 0));
	vector<vector<int>> pref_hor(n + 1, vector<int>(m + 1, 0));
	vector<vector<int>> pref_ver(n + 1, vector<int>(m + 1, 0));

	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			pref_sum[i + 1][j + 1] = pref_sum[i][j + 1] + pref_sum[i + 1][j] - pref_sum[i][j] + (a[i][j] - '0');
			// if (i < n - 1) {
				pref_ver[i + 1][j + 1] = pref_ver[i][j + 1] + pref_ver[i + 1][j] - pref_ver[i][j] + ver[i][j];
			// }
			// if (j < m - 1) {
				pref_hor[i + 1][j + 1] = pref_hor[i][j + 1] + pref_hor[i + 1][j] - pref_hor[i][j] + hor[i][j];
			// }
		}
	}

	// for (auto v : pref_sum) {
	// 	cerr << v << "\n";
	// }
	// cerr << "\n";
	// for (auto v : pref_hor) {
	// 	cerr << v << "\n";
	// }
	// cerr << "\n";
	// for (auto v : pref_ver) {
	// 	cerr << v << "\n";
	// }
	// cerr << "\n";

	while (q--) {
		int x1 = nxt() - 1, y1 = nxt() - 1, x2 = nxt(), y2 = nxt();
		// int cnt = pref_sum[n][m] - pref_sum[x2][y2] + pref_sum[x1][y2] + pref_sum[x2][y1] - pref_sum[x1][y1];
		// int hors = (y1 > 0 ? pref_hor[n][m] - pref_hor[x2][y2] + pref_hor[x1][y2] + pref_hor[x2][y1 - 1] - pref_hor[x1][y1 - 1] :
							 // pref_hor[n][m] - pref_hor[x2][y2] + pref_hor[x1][y2] + pref_hor[x2][y1] - pref_hor[x1][y1]);
		// int vers = (x1 > 0 ? pref_ver[n][m] - pref_ver[x2][y2] + pref_ver[x1 - 1][y2] + pref_ver[x2][y1] - pref_ver[x1 - 1][y1] :
							 // pref_ver[n][m] - pref_ver[x2][y2] + pref_ver[x1][y2] + pref_ver[x2][y1] - pref_ver[x1][y1]);
		int cnt = pref_sum[x2][y2] - pref_sum[x1][y2] - pref_sum[x2][y1] + pref_sum[x1][y1];
		int hors = pref_hor[x2][y2 - 1] - pref_hor[x1][y2 - 1] - pref_hor[x2][y1] + pref_hor[x1][y1];
		int vers = pref_ver[x2 - 1][y2] - pref_ver[x1][y2] - pref_ver[x2 - 1][y1] + pref_ver[x1][y1];
		printf("%d\n", cnt - hors - vers);
	}

	return 0;
}

Measured memory_bytes: 84480
#include <iostream>
#include <algorithm>
using namespace std;
#define int long long

int n;
int a[200001];

int Abs(int x) { if (x > 0) return x; return -x; }

signed main() {
	int i;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> a[i + 1];
	for (i = 1; i <= n; i++) a[i] += a[i - 1];
	
	int ans = 1e+18;
	for (i = 1; i < n; i++) {
		ans = min(ans, Abs(a[i] - (a[n] - a[i])));
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<map>
#define ll long long
using namespace std;
const int maxn = 1e5 + 10;
int a[maxn];
int n, k;
int check(int p) {
	int i = 0;
	int temp = 0, nk = k-1;
	for (i = 0; i < n; i++) {
		if (temp + a[i] <= p) {
			temp += a[i];
		}
		else if(nk>0&&a[i]<=p){
			temp = a[i];
			nk--;
		}
		else {
			return i;
		}
	}
	return i+1;
}
int main() {
//	freopen("input.txt", "r", stdin);
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	int l = 0, r = 1e9;
	while (l < r -1) {
		int m =(r+l)/2;
		if (check(m) >= n) {
			r = m;
		}
		else {
			l = m;
		}
	}
	printf("%d\n", r);
	return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    
    if((a>c && c>b) || (a<c && c<b)){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

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

#define int long long
#define uint unsigned int
#define pii pair<int, int>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,n,0)
#define ALL(c) ((c).begin()), ((c).end())

#define PB(a) push_back(a)
#define EMPB(...) emplace_back(__VA_ARGS__)
#define EMP(...) emplace(__VA_ARGS__)
#define MP(a,b) make_pair(a,b)
#define MT(...) make_tuple(__VA_ARGS__)

#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))

#define PW(n) (1LL << (n))

using namespace std;

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; }
template <class T> inline void SORT(T& a) { sort(a.begin(), a.end()); }
template <class T> inline void REV(T& a) { reverse(a.begin(), a.end()); }
template <class T> inline void UNI(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }

template <class S, class T> ostream& operator << (ostream& os, const pair<S, T> v) {
  os << "(" << v.first << ", " << v.second << ")"; return os;
}

const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

/* ---------------------------------------------------------------------------------------------------- */

int sz[3], K;
int a[3][1010];
using P = tuple<int, int, int, int>;
set<P> st;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  REP(i, 3) cin >> sz[i];
  cin >> K;
  REP(i, 3) REP(j, sz[i]) cin >> a[i][j];
  REP(i, 3) {
    sort(a[i], a[i]+sz[i]);
    reverse(a[i], a[i]+sz[i]);
  }
  priority_queue<P> que;
  que.EMP(a[0][0] + a[1][0] + a[2][0], 0, 0, 0);
  REP(i, K) {
    P p = que.top(); que.pop();
    int v, x, y, z;
    tie(v, x, y, z) = p;
    cout << v << endl;
    if (x+1 < sz[0] && !st.count(MT(v-a[0][x]+a[0][x+1], x+1, y, z))) {
      st.insert(MT(v-a[0][x]+a[0][x+1], x+1, y, z));
      que.EMP(v-a[0][x]+a[0][x+1], x+1, y, z);
    }
    if (y+1 < sz[1] && !st.count(MT(v-a[1][y]+a[1][y+1], x, y+1, z))) {
      st.insert(MT(v-a[1][y]+a[1][y+1], x, y+1, z));
      que.EMP(v-a[1][y]+a[1][y+1], x, y+1, z);
    }
    if (z+1 < sz[2] && !st.count(MT(v-a[2][z]+a[2][z+1], x, y, z+1))) {
      st.insert(MT(v-a[2][z]+a[2][z+1], x, y, z+1));
      que.EMP(v-a[2][z]+a[2][z+1], x, y, z+1);
    }
  }

  return 0;
}

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

int n;
vector<int> a(30);
bool rec(int d,int t){
  if(t == 0) return true;
  if(d == n||t<0) return false;
  return rec(d + 1,t)||rec(d + 1,t- a.at(d));
}

int main() {
    int q;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    cin >> q;
    vector<int> m(q);
    for(int i = 0; i < q; i++) {
        cin >> m.at(i);
    }
    for(int i = 0; i < q; i++) {
      if(rec(0, m.at(i))) cout << "yes" << endl;
      else cout << "no" << endl;
    }
}


Measured memory_bytes: 3092
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long 
#define sort(v) sort(v.begin(),v.end()) 
#define pb push_back
/*ll ar[1000000+9]={0}; 
void seiv() { 
ll n=1000000,i,j; 
ar[1]=1; 
for(i=4;i<=n;i+=2)ar[i]=1; 
for(i=3;i<=n;i+=2) 
{ if(ar[i]==0) 
{ for(j=i*i;j<=n;j+=i*2)ar[j]=1; }
 } 
*/
int main()
{
    
    ll a,b,c,d,e,i;
    cin>>a>>b>>c>>d;
for(i=1;i<=d;i++)
{
    
  if(b>=c)c*=2;
  else if(a>=b)b*=2;
  // cout<<a<<" "<<b<<" "<<c<<endl;
 if(a<b&&a<c&&c>b){cout<<"Yes\n";return 0;}
}
  cout<<"No\n";



}

Measured memory_bytes: 3564
s = ''.join(list(reversed(input())))
words = {'remaerd', 'resare', 'maerd', 'esare'}
word = ''
j = 0
for i in range(len(s)-4):
    if j == 0:
        a = s[i:i+5]
        b = s[i:i+6]
        c = s[i:i+7]
        if a in words:
            word += a
            j = 4
        elif b in words:
            word += b
            j = 5
        elif c in words:
            word += c
            j = 6
    else:
        j -= 1
if word == s:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 9860
#include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+10;
int a[maxn],b[maxn],n;
priority_queue<pair<int,int>> s;
long long ans=0;

int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=0;i<n;i++){
        scanf("%d",&b[i]);
        s.push(make_pair(b[i],i));
    }
    int l,r;
    while(!s.empty()){
        auto it=s.top();
        if(it.first==a[it.second]){
            s.pop();
            continue;
        }
        int l=((it.second)-1);
        if(l<0)l=n-1;
        int r=(l+2)%n;
        int sum=(b[l]+b[r]);
        if(b[it.second]<sum||b[it.second]-sum<a[it.second]){
            return !printf("-1");
        }
        if(a[it.second]>sum){
            if((b[it.second]-a[it.second])%sum)
                return !printf("-1");
            ans+=(b[it.second]-a[it.second])/sum;
            b[it.second]=a[it.second];
            s.pop();continue;
        }
        ///find the first number that is in form of
        ///b-sum*k<=sum sum*(k+1)>=b
        int cur=b[it.second]/sum-(b[it.second]%sum==0?1:0);
        b[it.second]-=sum*cur;
        ans+=cur;
        s.pop();
        s.push(make_pair(b[it.second],it.second));
    }
    printf("%lld\n",ans);
}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 3700
N = int(input())
A = list(map(int, input().split(" ")))

if N == 0:
    if A[0] != 1:
        print(-1)
        exit()
    else :
        print(1)
        exit()

need_node = A[-1]
if need_node > 2 ** N:
    print(-1)
    exit()

rev_a = A[::-1][1:]

for i in range(len(A)-1):
    need_node = rev_a[i] + (need_node + 1) // 2
    if need_node > 2 ** (N - i - 1):
        print(-1)
        exit()

# check OK
b = [0] * (N + 1)
b[0] = 1
for i in range(len(A) - 1):
    b[i + 1] = 2 * (b[i] - A[i])

node_total = 0
now_node = 0
reva = A[::-1]
revb = b[::-1]
for i in range(len(A)):
    now_node = min(reva[i] + now_node, revb[i])
    node_total += now_node

print(node_total)

Measured memory_bytes: 702984
s = input().split()
s = list(map(int,s))
ans = []

i = 0
while i<s[2]:
   if (i+s[0])>s[1]:
      i += 1
   elif (i+s[0])<=s[1]:
      ans.append(int(i + s[0]))
      i += 1

i = 0
while  i<s[2]:
   if (s[1]-i)>=s[0]:
       ans.append(int(s[1]-i))
       i += 1
   elif (s[1]-i)<s[0]:
       i += 1

ans = list(set(ans))
ans.sort()

for a in ans:
   print(a)

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

int main() {
  int A,B;
  cin>>A>>B;
  int N = -1;
  for(int i=0; i<=1000; i++){
    int X = i*0.08;
    int Y = i*0.1;
    if(X ==A &&Y==B){
      N = i;
      break;
    }
  }
  cout << N << endl;
}

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

#define ll long long
#define mx  100005
#define mod 1000000009
#define lim 10000000
#define inf 1000000000
#define N 18

using namespace std;
string s="";

void rep(int n)
{
	while(n)
	{
		int rem=n%(-2);
		rem=abs(rem);
		n=(n-rem)/(-2);
		if(rem)s+="1";
		else s+="0";
	}
}

int main(){
	ios_base::sync_with_stdio(false);
     int n;cin>>n;
     if(n==0)
	{
		cout<<"0\n";
		return 0;
	}
     rep(n);
     reverse(s.begin(),s.end());
     cout<<s<<"\n";
     return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <tuple>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_reverse(i, n) for (int i = (n)-1; (i) >= 0; --(i))
using namespace std;
template <class T> inline void setmax(T & a, T const & b) { a = max(a, b); }
template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

int main() {
    // input
    int h, w; cin >> h >> w;
    vector<string> s(h);
    repeat (y, h) cin >> s[y];
    // solve
    auto hist = vectors(h - 1, w, int());
    repeat (y, h - 1) {
        hist[y][w - 1] = 1;
        repeat_reverse (x, w - 1) {
            bool p = ((s[y][x] == s[y + 1][x]) == (s[y][x + 1] == s[y + 1][x + 1]));
            hist[y][x] = (p ? hist[y][x + 1] + 1 : 1);
        }
    }
    int result = w;
    repeat (x, w - 1) {
        stack<pair<int, int> > stk;
        repeat (i, (h - 1) + 1) {
            int h_i = (i < h - 1 ? hist[i][x] : 0);
            int j = i;
            while (not stk.empty() and stk.top().second > h_i) {
                int h_j; tie(j, h_j) = stk.top();
                stk.pop();
                setmax(result, h_j * (i - j + 1));
            }
            if (stk.empty() or stk.top().second < h_i) {
                stk.emplace(j, h_i);
            }
        }
    }
    // output
    printf("%d\n", result);
    return 0;
}


Measured memory_bytes: 20224
#include <bits/stdc++.h>
using namespace std;
#define INF 20000000000000
int main() {
    long long int n, i, bkCnt = 0, wtCnt = 0, st, minimum;
    minimum = INF;
    string s;
    pair<int, int> a[200000];
    cin >> n >> s;
    for (i = 0; i < n; i++) {
        if (s[i] == '#') {
            break;
        }
        a[i].first = -1;
        a[i].second = -1;
    }
    st = i;
    for (; i < n; i++) {
        if (s[i] == '#') {
            ++bkCnt;
        }
        a[i].first = bkCnt;
    }
    for (i = n - 1; st <= i; i--) {
        if (s[i] == '.') {
            ++wtCnt;
        }
        a[i].second = wtCnt;
    }
    for (i = st; i < n; i++) {
        if(minimum > a[i].second + a[i].first){
            minimum = a[i].second + a[i].first;
        }
    }
    if(minimum==INF){
        minimum=1;
    }
    cout << minimum-1 << endl;
    return 0;
}

Measured memory_bytes: 2180
import copy

N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
max_candies = 0

for i in range(len(A1)):
	candies = 0
	A1_c = copy.deepcopy(A1)
	A2_c = copy.deepcopy(A2)
	del A1_c[i+1:]
	del A2_c[:i]
	candies = sum(A1_c)+sum(A2_c)
	max_candies = max(max_candies,candies)

print(max_candies)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
int a,b;
int main()
{
	scanf("%d%d",&a,&b);
	double x=a*125,x_=x+125,y=b*100,y_=y+100;
	if ((y>=x&&y<x_)) printf("%d",(int)ceil(y/10));
	else if (x>=y&&x<y_) printf("%d",(int)ceil(x/10));
	else puts("-1");	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	double m,n;
	int i;
	char r[15]={0};
	for(;scanf("%lf",&n),n>0;)
	{
		for(m=128.0,i=0;i<13;i++)
		{
			if(i==8)
				r[i]='.';
			else if(n>=m)
				r[i]='1',n-=m,m/=2;
			else
				r[i]='0',m/=2;
		}
		if(n)
			puts("NA");
		else
			puts(r);
	}
	return 0;
}

Measured memory_bytes: 616
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def comb_mod(n, r):
    res = 1
    r = min(n - r, r)

    for i in range(r):
        res *= (n - i)
        res %= MOD
        res *= pow((r - i), MOD - 2, MOD)

    return res


def main():
    h, w, a, b = map(int, readline().split())

    ans = 0
    comb1 = 1
    comb2 = comb_mod(w - b - 1 + h - 1, w - b - 1)

    for i in range(h - a):
        ans += comb1 * comb2
        ans %= MOD
        comb1 *= (b - 1 + i + 1)
        comb1 %= MOD
        comb1 *= pow(i + 1, MOD - 2, MOD)
        comb1 %= MOD
        comb2 *= pow(w - 1 - b + h - 1 - i, MOD - 2, MOD)
        comb2 %= MOD
        comb2 *= w - 1 - b + h- 1 - i - (w - b - 1)
        comb2 %= MOD

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73712
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.playDaysCalculation();
		return;
	}
	
	//遊べる日数を計算する
	private void playDaysCalculation() {
		
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); //標準入力
		
		try {
			
			String inputStr = bufferedReader.readLine();
			int winterBreakDays = Integer.parseInt(inputStr);
			
			String inputStr2 = bufferedReader.readLine();
			double languageWorkbookPageNum = Double.parseDouble(inputStr2);
			
			String inputStr3 = bufferedReader.readLine();
			double arithmeticWorkbookPageNum = Double.parseDouble(inputStr3);
			
			String inputStr4 = bufferedReader.readLine();
			double languageProgressNum = Double.parseDouble(inputStr4);
			
			String inputStr5 = bufferedReader.readLine();
			double arithmeticProgressNum = Double.parseDouble(inputStr5);
			
			double languageWorkbookEndDays = languageWorkbookPageNum / languageProgressNum;
			double arithmeticWorkbookEndDays = arithmeticWorkbookPageNum / arithmeticProgressNum;
			
			int workbookEndDays = 0;
			if (languageWorkbookEndDays > arithmeticWorkbookEndDays) {
				workbookEndDays = (int)Math.ceil(languageWorkbookEndDays);
			} else if (languageWorkbookEndDays < arithmeticWorkbookEndDays) {
				workbookEndDays = (int)Math.ceil(arithmeticWorkbookEndDays);
			} else if (languageWorkbookEndDays == arithmeticWorkbookEndDays) {
				workbookEndDays = (int)Math.ceil(languageWorkbookEndDays);
			}
			
			System.out.println(winterBreakDays - workbookEndDays);
			
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
		
	}

}

Measured memory_bytes: 16912
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) x.begin(),x.end()
#define db(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, n, m) for(int i = n; i >= m; i--)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;

int main(){

  int A,B;
  cin >> A>>B;

  int C;
  C=(A+B)/2;

  if((A+B)%2==0) std::cout << C << '\n';
  else std::cout << "IMPOSSIBLE" << '\n';

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int A,B,C;
bool t(int A,int B,int C)
{
	for(int i=1;i<105;i++)
	{
		if(A*i%B==C)return 1;
	}
	return 0;
}

int main()
{
	scanf("%d%d%d",&A,&B,&C);
	puts(t(A,B,C)?"YES":"NO");

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define vi vector<int>
#define rep_(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) rep_(i, 0, n)
#define rev_(i, m, n) for(int i=(int)(m-1);i>=(int)(n);i--)
#define rev(i, n) rev_(i, n, 0)
#define each(i, n) for(auto&& i: n)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size()) 
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define dump(x) cerr << #x << "=" << x <<endl
#define gcd __gcd
int lcm(int a, int b){return a / gcd(a, b) * b;}
const int INF = 1e18;
const int MOD = 1e9 + 7;
const double EPS = 1e-15;
const double PI = acos(-1);

void solve()
{
	/*--------------------------*/

	vi A(3); cin >> A[0] >> A[1] >> A[2];
	set<int> st;
	each(a, A) st.insert(a);
	if (sz(st) == 2) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	/*--------------------------*/
}

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	solve();
}

Measured memory_bytes: 256
# スペース区切りの整数入力
h,k = map(int, input().split())
# スペース区切りの整数をリストに入力
h = [int(x) for x in input().split()]
hh = 0
for i in sorted(h,reverse=True)[k:]:
    hh = hh + i

print(hh)



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

int kaibunn(string S){
    int N = S.length();
    if (N % 2 == 1){
        for (int i = 0; i < (N-1)/2; i++){
            if (S[i] != S[N-1-i]){
                return 0;
            }
        }
        return 1;
    }else{
        for (int i = 0; i < N/2; i++){
            if (S[i] != S[N-1-i]){
                return 0;
            }
        }
        return 1;
    }
}

int main(){
    string S,S1,S2;
    cin >> S;
    int N = S.length();
    S1 = S.substr(0,(N-1)/2);
    S2 = S.substr((N+3)/2-1,N-((N+3)/2-1));
    if (kaibunn(S) == 1 && kaibunn(S1) == 1 && kaibunn(S2) == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

typedef long long ll;

int main() {
    string s;
    int sum, mx;

    cin >> s;

    sum = mx = 0;

    f(i, s.size()) {
        if(s.at(i) =='A' || s.at(i) =='C' || s.at(i) =='G' || s.at(i) =='T') {
            sum++;
        } else {
            mx = max(mx, sum);
            sum = 0;
        }
    }

    mx = max(mx, sum);

    cout << mx << endl;

    return 0;
}

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

typedef long long int ll;
const int mod = 1e9+7;
const ll inf = 1e18;
const double pi = 3.1415926535897932384626;

void solve(){
	//code
	int n,k;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++) cin>>arr[i];
	
	sort(arr,arr+n);
	int s=0;
	for(int i=0;i<k;i++)
		s+=arr[i];
		
	cout<<s;
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
 	return 0;
}


Measured memory_bytes: 3620