akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int N;
	cin >> N;
	vector<int>P(N);
	rep(i, N) {
		cin >> P[i];
	}
	sort(P);
	reverse(P);
	int sum = 0;
	sum += (P[0] / 2);
	for (int i = 1; i < N; i++) {
		sum += P[i];
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;
ll dp[50][3000];
int main()
{
    fast;
    
	ll n,k,ans=0;

cin>>n>>k;


ans=k*pow(k-1,n-1);
cout<<ans;
}

		
	
	
	
	


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

using namespace std;

int main() {
#ifdef wxh010910
  freopen("input.txt", "r", stdin);
#endif
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a.begin(), a.end());
  vector<int> b(n);
  for (int i = n - 1; ~i; --i) {
    b[i] = 1;
    while (b[i] <= a[i]) {
      b[i] <<= 1;
    }
    b[i] -= a[i];
  }
  int answer = 0;
  map<int, int> c;
  for (int i = 0; i < n; ++i) {
    ++c[a[i]];
  }
  for (int i = n - 1; ~i; --i) {
    if (c[a[i]]) {
      --c[a[i]];
      if (c[b[i]]) {
        --c[b[i]];
        ++answer;
      }
    }
  }
  printf("%d\n", answer);
  return 0;
}


Measured memory_bytes: 20608
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

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

  int a, b, q;
  cin >> a >> b >> q;
  std::vector<int64_t> s, t;
  for (int i = 0; i < a; i++) {
    int64_t m1;
    cin >> m1;
    s.push_back(m1);
  }
  for (int i = 0; i < b; i++) {
    int64_t m1;
    cin >> m1;
    t.push_back(m1);
  }
  std::sort(s.begin(), s.end());
  std::sort(t.begin(), t.end());
  for (int i = 0; i < q; i++) {
    int64_t query;
    cin >> query;

    auto isr = std::lower_bound(s.begin(), s.end(), query);
    auto isl = s.end();
    if (isr != s.begin()) {
      isl = isr;
      isl--;
    }
    auto itr = std::lower_bound(t.begin(), t.end(), query);
    auto itl = t.end();
    if (itr != t.begin()) {
      itl = itr;
      itl--;
    }
    // cout << *isl << "\t" << *isr << "\t" << *itl << "\t" << *itr << endl;
    int64_t result = INT64_MAX;
    if (isl != s.end() && itl != t.end()) {
      int64_t temp = query - std::min(*isl, *itl);
      result       = std::min(result, temp);
    }
    if (isr != s.end() && itr != t.end()) {
      int64_t temp = std::max(*isr, *itr) - query;

      result = std::min(result, temp);
    }
    if (isl != s.end() && itr != t.end()) {
      int64_t temp1 = query - *isl + *itr - *isl;
      int64_t temp2 = *itr - query + *itr - *isl;

      result = std::min({result, temp1, temp2});
    }
    if (isr != s.end() && itl != t.end()) {
      int64_t temp1 = *isr - query + *isr - *itl;
      int64_t temp2 = query - *itl + *isr - *itl;

      result = std::min({result, temp1, temp2});
    }
    cout << result << endl;
  }

  return 0;
}


Measured memory_bytes: 3060
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
////------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//
////clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//
////debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int  gcd(int a,int b){
     int c;
     while((a%b)!=0){
     	 c=a%b;
	 a=b;
	 b=c;
     }
     return b;
}


int main(){
  int a, b;
  cin>>a>>b;
  cout<<gcd(a,b)<<endl;
  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main(){
    int a,b,x,y;
    double z;
    scanf("%d %d",&a,&b);
    x=a/b;
    y=a%b;
    z=1.0*a/b;
    printf("%d %d %f\n",x,y,z);
    return 0;
}


Measured memory_bytes: 2052
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) begin(x),end(x)
 
#define forn(i, n) for (int i = 0; i < n; ++i)
#define rforn(i, n) for (int i = n - 1; i >= 0; --i)
 
const int N = 2e5 + 5, M = 1e9 + 7; // 998244353
const int dx[]{0, 1, 0, -1}, dy[]{1, 0, -1, 0};
const ll INF = 1e18 + 10LL;
const ld PI = 4.0 * atan((ld) 1.0), EPS = 1e-6;
const char nl = '\n';
 
template <typename T> inline T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> inline T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> void ckmin(T& a, T b) { a = min(a, b); }
template <class T> void ckmax(T& a, T b) { a = max(a, b); }
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
string YN(bool x) { return x ? "YES" : "NO"; }
 
ll pow(ll b, ll e, ll m = 0LL, ll ans = 1LL) { while (e) { if (e & 1LL) { ans *= b; if (m) ans %= m; } b *= b, e >>= 1LL; if (m) b %= m; } return ans; }
 
ll fact[1<<21], inv[1<<21];
 
ll C(int x, int y) {
	if (y < 0 || y > x)
		return 0LL;
	return fact[x] * inv[y] % M * inv[x-y] % M;
}
 
void precomp() {
	fact[0] = 1LL;
	for (int i = 1; i < (1 << 21); ++i)
		fact[i] = fact[i-1] * i % M;
	inv[(1<<21) - 1] = pow(fact[(1<<21)-1], M - 2, M);
	for (int i = (1 << 21) - 2; i >= 0; --i)
		inv[i] = inv[i+1] * (i + 1) % M;
}
 
void solve(int tcn) {
	int k, n;
	string s;
	cin >> k >> s, n = (int) s.length();
	ll ans = 0LL;
	for (int i = n; i <= k + n; ++i) {
		ans += (C(k + n, i) % M) * (pow(25LL, k + n - i, M) % M) % M;
		ans = ans % M;
	}
	cout << ans << nl;
}
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	precomp();
	int t = 1; //cin >> t;
	for (int i = 1; i <= t; ++i) {
		solve(i);
	}
	return 0;
}

Measured memory_bytes: 37016
n = int(input())
l = []
ans = "Yes"
for i in range(n):
    a, b = map(int, input().split())
    l.append([b, a])
l.sort(reverse=True)
tmp = l[0][0]
for i in range(n):
    if tmp > l[i][0]:
        tmp = l[i][0]
    tmp -= l[i][1]
    if tmp < 0:
        ans = "No"
        break
print(ans)

Measured memory_bytes: 35620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);
 
 		int a =fr.nextInt() ,b =fr.nextInt() ,c =fr.nextInt() ,k =fr.nextInt() ,ans =0 ;
 		ans =Math.min(k , a) ;	k -= Math.min(k,a) ;	k -= Math.min(k,b) ;
 		ans -= Math.min(k,c) ;	op.println(ans) ;
		op.flush();	op.close();
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br =new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st==null || (!st.hasMoreElements())) 
			{
				try
				{
					st =new StringTokenizer(br.readLine());
				}
				catch(IOException e)
				{
					e.printStackTrace();
				}
				
			}
			return st.nextToken();
		}

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

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

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

Measured memory_bytes: 32936
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#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(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll ret = 0;
string s;

int main(void){
  ll M;
  IN(N);
  IN(M);
  vl H(N+1);
  vector<bool> nice(N, true);
  REP(i, N) {
    IN(H[i+1]);
  }
  REP(i, M) {
    ll A, B;
    IN(A);
    IN(B);
    if (H[A] <= H[B]) nice[A] = false;
    if (H[B] <= H[A]) nice[B] = false;
  }
  FOR(i, 1, N+1) {
    if (nice[i]) ret++;
  }
  PRINT(ret);

}


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

int main() {
  int k,a,b;
  int i;
  bool j=false;
    
  cin >> k >> a >> b;
  
  for(i=a;i<=b;i++){
    if(i%k == 0){
      j = true;
    }
  }
  
  if(j){
    cout << "OK" << endl;
  }else{
    cout << "NG" << endl;
  }
}

Measured memory_bytes: 3636
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<int>v(N);
	for (auto &i : v)cin >> i;
	auto w = v;
	sort(w.begin(), w.end());
	map<int, int>m;
	for (int i = 0; i < N; i++)m[v[i]] = i;
	for (int i = 0; i < N; i++) {
		if (m[w[i]] % 2 != i % 2)M++;
	}
	cout << M / 2 << endl;
}

Measured memory_bytes: 5760
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
#define ll long long
using namespace std;
int n,a,b,ans[300010];
int read()
{
	int x=0,f=1;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x*f;
}
int main()
{
	n=read();a=read();b=read();
	if(a+b-1>n||(ll)a*b<n) {puts("-1");return 0;}
	int cnt=0,lst=b;
	ans[0]=-b+1;
	for(int i=1;i<=n-a;i++)
	{
		//cout<<i<<' '<<cnt<<' '<<a<<endl;
		if(cnt==0)
		{
			
			cnt=min(n-i-a+1,b-1);
			ans[i]=ans[i-1]+b+cnt;
			a--;
		}
		else cnt--,ans[i]=ans[i-1]-1;
	}
	for(int i=n-a+1;i<=n;i++)
		ans[i]=i;
	for(int i=1;i<=n;i++)
		cout<<ans[i]<<' ';
	
    return 0;
}



Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		  string s;
           cin>>s;
           int n=s.size();
           int ans=0;
           char now='1';
           rep(i,0,n){
             if(s[i]!=now){
               now=s[i];
             }
             else{
              i++;
               now='1';
             }
             if(i==n)break;
             ans++;
           }
           cout<<ans<<endl;
           //bbbbcbbbbb
}

Measured memory_bytes: 3704
S = gets.chomp
A = S[0]
B = S[1]
C = S[2]
D = S[3]

(0..(1<<3)).each do |n|
  ope = []
  3.times do |i|
    ope << ((n&(1<<i)) == 0 ? "+" : "-")
  end
  s = "#{A}#{ope[0]}#{B}#{ope[1]}#{C}#{ope[2]}#{D}"
  #p "#{s}=#{eval(s)}"
  if eval(s) == 7
    puts "#{s}=7"
    exit
  end
end


Measured memory_bytes: 1788
//package com.daimens.algorithm.june;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * 
 * @author DemonSong
 * 
 *         5.GCD and LCM
 * 
 *         GCD and LCM Time Limit : 1 sec, Memory Limit : 65536 KB Japanese
 *         version is here GCD and LCM Write a program which computes the
 *         greatest common divisor (GCD) and the least common multiple (LCM) of
 *         given a and b.
 * 
 *         Input Input consists of several data sets. Each data set contains a
 *         and b separated by a single space in a line. The input terminates
 *         with EOF.
 * 
 *         Constraints 0 < a, b ??? 2,000,000,000 LCM(a, b) ??? 2,000,000,000 The
 *         number of data sets ??? 50 Output For each data set, print GCD and LCM
 *         separated by a single space in a line.
 * 
 *         Sample Input 8 6 50000000 30000000 Output for the Sample Input 2 24
 *         10000000 150000000
 * 
 *
 */
public class Main{

	public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        long a,b;
 
 
        while((str=br.readLine()) != null){
            a = Long.parseLong(str.substring(0, str.indexOf(" ")));
            b = Long.parseLong(str.substring(str.indexOf(" ")+1, str.length()));
 
            System.out.println(gcd(a, b) + " " + lcm(a,b));
 
        }
    }
	
	private static long gcd(long a, long b){
		if (b == 0) return a;
		return gcd(b, a % b);
	}
	
	private static long lcm(long a, long b) {
		return a * b / gcd(a, b);
	}

}

Measured memory_bytes: 24144
import sys

sys.setrecursionlimit(10**6)

N, u, v = map(int, input().split())
tree = [[] for _ in range(N)]
for _ in range(N-1):
  a, b = map(int, input().split())
  tree[a-1].append(b-1)
  tree[b-1].append(a-1)
#print(tree)

def calc_dist(dlist, n, dist, nnode):
  for c in tree[n]:
    if c == nnode:
      continue
    dlist[c] = dist
    calc_dist(dlist, c, dist+1, n)
    
u_dist_list = [0] * N
calc_dist(u_dist_list, u-1, 1, -1)
#print(u_dist_list)

v_dist_list = [0] * N
calc_dist(v_dist_list, v-1, 1, -1)
#print(v_dist_list)

ans = 0
for i in range(N):
  if (v_dist_list[i] - u_dist_list[i]) > 0 and v_dist_list[i] > ans:
    ans = v_dist_list[i] - 1
    
print(ans)

Measured memory_bytes: 101036
/* fucklove - when you give everything to someone and it's stil not enough */
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>

 
using namespace std;
 
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
 
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
 
const ll N=1e3 + 5 ,  INF = 1e6 + 10 , md=1e9+7;
 
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b);} 
int takemod(int a, int mod ){a%=mod;if(a<0)a+=mod;return a;}
int fast_exp(int base, int expo, int mod ) {
	int res=1;
	while(expo>0) {
		if(expo&1) res=(res*base)%mod;
		base=(base*base)%mod;
		expo>>=1;}
	return res;}
int modinv(int a, int mod ){return takemod(fast_exp(takemod(a,mod), mod-2, mod), mod);}


int main()
{
	fast_cin();
	int t=1;
//	cin >> t;
	while(t--){
		unordered_set<int> st;
		int n; cin >>n;
		int check=1;
		for(int i=0;i<n;i++){
			int x;cin>>x;
			if(st.count(x)>0){
				check=0;
			}
			else{
				st.insert(x);
			}
		}
		if(check){
			cout<<"YES"<<endl;
		}
		else
			cout <<"NO"<<endl;

	
	}
	return 0;
}
 

Measured memory_bytes: 8520
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <cmath>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <unordered_map>
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define ll long long
#define INF ((1<<30)-1)
#define NEG (-1)
#define MOD 1000000007
#define MAXN 100100
#define EPS 1e-9
#define INFLL 1e18
using namespace std;
FILE *in,*out;

ll N;
string str;

int read()
{
    int i,j,k;
    cin >> str;
    cin >> N;
    for(i=0;i<(int)(str).size();i++)
        if(str[i]!='1')
            break;
    if(N-1>=i)
        printf("%c\n",str[i]);
    else
        printf("1\n");
    
    return 0;
}

int main()
{
    // in = fopen("A.in","r");
    // out  = fopen("A.out","w");
    in = stdin;
    out = stdout;
    read();
    return 0;
}
//////////// Local Snippets
// forx
// fory
// vectorx
// pairx
// sizex

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

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for (int i=a; i<b; i++)
#define M00(i, a) for (int i=0; i<a; i++)
#define MOOd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define M00d(i,a) for (int i = (a)-1; i >= 0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _<< " _ " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;

const ll N = 2010;
//i,j = [i, j];
ll DP[N][N];

int main() { FAST
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	int n;
	cin >> n;
	vector<pair<ll, int>> val(n);
	M00(i, n) {
		ll x;
		cin >> x;
		val[i] = mp(-x, i);
	}
	sort(all(val));
	for(int len = 1; len <= n; len++) {
		for(int i = 0; i < n+1-len; i++) {
			if(len == 1) {
				DP[i][i] = (-val[n-1].f) * abs(val[n-1].s - i);
			} else {
				DP[i][i+len-1] = max( DP[i+1][i+len-1] + (-val[n-len].f) * abs(val[n-len].s - i)
									, DP[i][i+len-2] + (-val[n-len].f) * abs(val[n-len].s - (i+len-1)));
			}	
		}
	}
	finish(DP[0][n-1]);
}


Measured memory_bytes: 26324
#include<bits/stdc++.h>
#define int double
using namespace std;
signed main()
{
    int t,d;
    cin>>t>>d;
    int dem=0;
    while(t--)
    {
        int x,y;
        cin>>x>>y;
        int k=sqrt(x*x+y*y);
        if(k<=d)
            dem++;
    }
    cout<<dem;
    return 0;
}


Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}
int main(){
  int n;
  cin>>n;
  int a[100002];
  lp(i,100002){
    a[i]=1;
  }
  lp(i,n){
    int x,y;
    cin>>x>>y;
    for(int i=x;i<=y;i++){
      a[i]+=1;
    }
  }
  int ans=0;
  lp(i,n+2){
    if(a[i]>=i) ans=i;
  }
  if(ans==0) cout<<0<<endl;
  else 
  cout<<ans-1<<endl;
  return 0;
    
}



Measured memory_bytes: 3488
use std::io::*;
use std::str::FromStr;
   
fn read<T: FromStr>() -> T {
	let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
	let n = read();
    let mut v: Vec<(i32, i32)> = (0..n).map(|_| (read(), read())).collect();

	let mut distance = 0.0;
	for i in 0..n {
		for j in 0..n {
			if i != j {
				let a = v[i as usize].0;
                let b = v[i as usize].1;
                let c = v[j as usize].0;
                let d = v[j as usize].1;
				distance += (((a - c) * (a - c) + (b - d) * (b - d)) as f64).sqrt();
			}
		}
	}
	distance /= n as f64;
	println!("{}", distance);
}

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

int main(){
  string s;
  cin >> s;
  int N = s.size();
  for(int i = 0;  i < N; i++){
    if(i%2 == 0){
      cout << s.at(i);
    }
  }
  cout << endl;
}
    


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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define maxn 100
#define int long long int
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

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

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

int mpow(int N, int P, int M) //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0)
    {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x)
{ //bit計算
    if (x == 0)
        return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void)
{
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++)
    {
        if (!prime[i])
        {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i)
        {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
signed main()
{
    int N, H;
    cin >> N >> H;
    int all_b = 0;
    int max_a = 0;
    int place = 0;
    vector<int> a, b;
    rep(i, N)
    {
        int A, B;
        cin >> A >> B;
        if (A > max_a)
        {
            max_a = A;
        }
        all_b += B;
        a.push_back(A);
        b.push_back(B);
    }
    int sub = 0;
    rep(i, N)
    {
        if (b[i] >= max_a)
        {
            sub += b[i];
            place++;
        }
    }
    sort(b.begin(), b.end(), greater<int>());
    if (all_b >= H)
    {
        int h = H;
        int count_b = 0;
        for (int i = 0; i < N; i++)
        {
            h -= b[i];
            if (h <= 0)
            {
                count_b = i + 1;
                break;
            }
        }
        H -= sub;
        if (H < 0)
        {
            H = 0;
        }
        if ((ceil((double)H / max_a) + place) > count_b)
        {
            cout << count_b << endl;
        }
        else
        {
            cout << fixed << setprecision(10) << (int)ceil((double)H / max_a) + place << endl;
        }
    }
    else
    {
        H -= sub;
        if (H < 0)
        {
            H = 0;
        }
        cout << fixed << setprecision(10) << (int)ceil((double)H / max_a) + place << endl;
    }
}


Measured memory_bytes: 2036
import java.util.*;

public class Main {

    public static void printX(int n){
        if(n <= 1000000 && n >= -1000000){
            System.out.print(n);
        }
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = 2000001;

        int K = sc.nextInt();
        int X = sc.nextInt();

        for(int i = X - K + 1; i <= X; i++){
            printX(i);
            System.out.print(" ");
        }

        for(int i = X+1; i < X + K; i++){
            printX(i);
            if(i != X + K -1){
                System.out.print(" ");
            }
        }


    }
}

Measured memory_bytes: 22736
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<tuple>


#define MOD 1000000007
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back

using namespace std;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    int N;
    int X;
    int L[100];
    cin>>N>>X;
    rep(i,0,N)cin>>L[i];
    int now=0;
    int ans=0;
    rep(i,0,N){
        now+=L[i];
        if(now<=X)ans++;
    }
    ans++;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b;
	char op;
	int ans;
	int loop=1;
	while(loop){
	scanf("%d %c %d",&a, &op, &b);
	switch(op){
		case '+': ans = a+b; break;
		case '-': ans = a-b; break;
		case '*': ans = a*b; break;
		case '/': ans = a/b; break;
		case '?': break;
	}
	if(op != '?'){
	printf("%d\n",ans);
	}else{
		loop=0;
	}
	}
	return 0;
}

Measured memory_bytes: 2696
from collections import Counter
import itertools

H, W, N = map(int,input().split())
blacks = []
for i in range(N):
    blacks.append(tuple(map(int,input().split())))

blacks_in_square = [(x+dx,y+dy) for x,y in blacks\
                    for dx in [-1,0,1] for dy in [-1,0,1]\
                    if 1 < x+dx < H and 1 < y+dy < W]

ans = [0] * 10
for x,y in Counter(Counter(blacks_in_square).values()).items():
    ans[x] = y
ans[0] = (H-2) * (W-2) - sum(ans)
print('\n'.join(map(str,ans)))


Measured memory_bytes: 211964
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    
	public static void main(String[] args) {
	  FastReader sc = new FastReader();
	  int a = sc.nextInt();
	  int b = sc.nextInt();
	  int res = 0;
	  
	  if (a > b) {
		  res += a;
		  a--;
	  } else {
		  res += b;
		  b--;
	  }
	  if (a > b) {
		  res += a;
		  a--;
	  } else {
		  res += b;
		  b--;
	  }
	  System.out.println(res);
	  
  }
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

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

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

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


Measured memory_bytes: 21204
N, C, K = map(int, input().split())
T = []
for _ in range(N):
    x = int(input())
    T.append(x)
T.sort()
lim = 0
tim = 0
ans = 0
for i in range(N):
    if lim == 0:
        lim += 1
        tim = T[i]
    else:
        if tim + K >= T[i] and lim < C:
            lim += 1
        else:
            lim = 1
            tim = T[i]
            ans += 1

print(ans+1)

Measured memory_bytes: 7388
import sys
import copy
from collections import deque

sys.setrecursionlimit(1000000000)

def dfs(xs,q):
    if len(xs) == 0:
        return sum(int(i) for i in q)

    x = xs.popleft()

    if len(q) == 0:
        q.append(x)
        return dfs(xs,q)


    a1 = copy.copy(xs)
    a2 = copy.copy(xs)

    q1 = copy.copy(q)
    q2 = copy.copy(q)

    q1.append(x)

    y  = q2.pop()
    yx = y + x
    q2.append(yx)

    return dfs(a1,q1) + dfs(a2,q2)


s  = str(input())
xs = deque(list(s))

print(dfs(xs,deque([])))

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
typedef long long ll;
ll gcd(ll x,ll y)
{
    if(x == 0 || y == 0)return max(x, y);
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}
int main(){
    ll n; cin >> n;
    vector<ll> a(n), l(n+1, 0), r(n+1, 0);
    rep(i,n)cin >> a[i];
    rep(i,n)l[i+1] = gcd(l[i], a[i]);
    repr(i,n)r[i] = gcd(r[i+1], a[i]); 
    ll ans = -1;
    /*rep(i,n+1)cout << l[i] << ((i < n)?" ":"\n");
    cout << "  ";
    rep(i,n+1)cout << r[i] << ((i < n)?" ":"\n");
    */
    rep(i,n)ans = max(ans, gcd(l[i], r[i+1]));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int longest_common_subsequence_length(vector<int> &A, vector<int> &B){
	vector<vector<int>> dp(A.size() + 1, vector<int>(B.size() + 1, 0));
	for (int i = 0; i < A.size(); i++){
		for (int j = 0; j < B.size(); j++){
			if (A[i] == B[j]){
				dp[i + 1][j + 1] = dp[i][j] + 1;
			} else {
				dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
			}
		}
	}
	return dp[A.size()][B.size()];
}
int main(){
  int q;
  cin >> q;
  for (int i = 0; i < q; i++){
      string X, Y;
      cin >> X >> Y;
      vector<int> A(X.begin(), X.end());
      vector<int> B(Y.begin(), Y.end());
      cout << longest_common_subsequence_length(A, B) << endl;
  }
}


Measured memory_bytes: 6856
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
    int n;cin>>n;
    vector<pair<ll,ll> > v(n);
    for(int i=0;i<n;i++){
        cin>>v[i].second>>v[i].first;
    }
    sort(v.begin(),v.end());
    ll cur=0;
    for(int i=0;i<n;i++){
        cur+=v[i].second;
        if(cur>v[i].first){cout<<"No";return 0;}
    }
    cout<<"Yes";
}

Measured memory_bytes: 3328
#include<cstdio>
#include<cstring>
#include<iostream>
char a[100100];
int c, f;
int main() {
    scanf("%s", a);
    int n=strlen(a);
    for(int i=0; i<n; i++) {
        if(a[i]=='C') c=1;
        if(a[i]=='F'&&c==1) f=1;
    }
    if(f==1) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
	long long i,j;
	scanf("%lld%lld",&i,&j);
	if(i>1)
		i-=2;
	if(j>1)
		j-=2;
	printf("%lld",i*j);
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
bool func(int n, int m, vector<int> a, vector<int> b, int c){
    int cnt = 0;
    vector<bool> vsd(n, false);
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int v = q.front(); q.pop();
        if(vsd[v]) continue;
        vsd[v] = true;
        cnt++;
        for(int i=0;i<m;i++){
            if(i == c)continue;
            if(a[i] == v) q.push(b[i]);
            if(b[i] == v) q.push(a[i]);
        }
    }
    return cnt != n;
}

int main(void){
    int n, m, ans = 0;
    vector<int> a, b;
    cin >> n >> m;
    a.assign(m, 0);
    b.assign(m, 0);
    for(int i=0;i<m;i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
    for(int i=0;i<m;i++){
        if(func(n, m, a, b, i)) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
string s;
int main()
{
	int n;
	cin>>n;
	ios;
	cin>>s;
	int num=0,len=s.size();
	for(int i=0;i<len-2;++i)
	{
		if(s[i]!='A')continue;
		else
		{
			if(s[i+1]=='B'&&s[i+2]=='C')
			{
				num++;
			}
		}
	}
	cout<<num<<'\n';
}

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

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

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
    if (k >= -(a-b) &&
        k >= -(a-c) &&
        k >= -(a-d) &&
        k >= -(a-e) &&
        k >= -(b-c) &&
        k >= -(b-d) &&
        k >= -(b-e) &&
        k >= -(c-d) &&
        k >= -(c-e) &&
        k >= -(d-e) )
    {
        cout<<"Yay!"<<endl;
    }
    else{
        cout<<":("<<endl;
    }
    
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int i,n,s[1024],p[1024],q[1024],r[1024],Q,R,P,C,m;
	while(1){
		scanf("%d",&n);
		if(n==0){
			break;
		}
		for(i=0;i<n;i++){
			scanf("%d%d%d%d",&s[i],&p[i],&q[i],&r[i]);
		}
		scanf("%d%d%d%d",&P,&Q,&R,&C);
		m=1;
		for(i=0;i<n;i++){
			if(p[i]<=P&&q[i]<=Q&&r[i]<=R&&4*p[i]+9*q[i]+4*r[i]<=C){
				printf("%d\n",s[i]);
				m=0;
			}
		}
		if(m){
			printf("NA\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2676
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
typedef long long LL;
#define FOR(i, a, b) for(LL i=(LL)(a);i<(LL)(b);i++)
#define REP(i,x) for(LL i=0;i<(LL)(x);i++)

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    // cout << fixed << setprecision(10);

    LL A, B;
    cin >> A >> B;
    REP(i, 10100)
    {
        LL zei8 = (i * 8) / 100;
        LL zei10 = (i * 10) / 100;
        if(A == zei8 && B == zei10)
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
from fractions import gcd
from functools import reduce
N,M = map(int, input().split())
A = list(set(map(lambda x: int(x)//2, input().split())))
lcm = A[0]
for a in A[1:]:
  l = lcm*a//gcd(lcm,a)
  if not (l//lcm%2 and l//a%2):
    print(0)
    exit()
  lcm = l
print((M//lcm+1)//2)


Measured memory_bytes: 13328
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[n];

		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
		}

		int min = Integer.MAX_VALUE;
		for (int p = 0; p < 101; p++) {
			int total = 0;
			for ( int i = 0; i < n; i++) {
				total += (x[i] - p) * (x[i] - p);
			}

			if (total < min) {
				min = total;
			}
		}

		System.out.println(min);

	}

}


Measured memory_bytes: 35940
import numpy as np

n = int(input())

sum = np.zeros(4, dtype=np.int)

for i in range(n):
  s = input()
  if s == "AC":
    sum[0] += 1
  elif s == "WA":
    sum[1] += 1
  elif s == "TLE":
    sum[2] += 1
  else:
    sum[3] += 1

print("AC x ", sum[0])
print("WA x ", sum[1])
print("TLE x ", sum[2])
print("RE x ", sum[3])

Measured memory_bytes: 27196
#include <bits/stdc++.h>
using namespace std;
string s;
int main(){
	cin>>s;
	int n=s.size();
	bool flag=0;
	int p=1,q=n;
	while (p<=q){
		if (s[p-1]!=s[q-1]){
			flag=1;
			break;
		}
		p++,q--;
	}
	if (flag){
		cout<<"No";
		return 0;
	}
	p=1,q=(n-1)/2;
	while (p<=q){
		if (s[p-1]!=s[q-1]){
			flag=1;
			break;
		}
		p++,q--;
	}
	if (flag){
		cout<<"No";
		return 0;
	}
	cout<<"Yes";
	return 0;
}



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

using namespace std;
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define sz(a) (int)(a).size()
#define rep(i, a, b) for (int i = (a), _b = (int)(b); i < _b; ++i)

typedef complex<ld> cplex;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

const int inf = 1000000007;
const ll linf = 1ll * inf * inf;
const int N = 100000 + 7;
const int M = 10;
const int multipleTest = 0;

ll q, h, s, d;
ll n;

void solve() {
    cin >> q >> h >> s >> d >> n;
    h = min(h, 2 * q);
    s = min(s, 2 * h);
    d = min(d, 2 * s);
    
    ll res = n / 2 * d;
    if (n & 1) res += s;
    cout << res;
    
}

int main() {
#ifdef _LOCAL_
    freopen("in.txt", "r", stdin);
    //    freopen("out.txt", "w", stdout);
#endif
    int Test = 1;
    if (multipleTest) {
        cin >> Test;
    }
    for(int i = 0; i < Test; ++i) {
        solve();
    }
#ifdef _LOCAL_
    cout<<"\n" << 1.0 * clock() / CLOCKS_PER_SEC <<endl;
#endif
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define maxn 500005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;

int main()
{
    int i , j , k , l , m , n ;

    scanf("%d",&n) ;

    int x1=0, x2 , y1=0 , y2 ;
    int t1 = 0 , t2 ;
    int fl = 1 ;
    for(i=1 ; i<=n ; i++)
    {
        scanf("%d %d %d",&t2,&x2,&y2) ;
        int ret = abs(x2-x1) + abs(y2-y1) ;
        if( ret>(t2-t1) || (t2-t1 - ret)%2==1 ) fl = 0 ;
        t1 = t2 ;
        x1 = x2 ; y1 = y2 ;
    }

    if(fl==0) printf("No\n") ;
    else printf("Yes\n") ;

    return 0 ;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

# In[3]:


from itertools import product


# In[16]:


S = input()


# In[17]:


length = len(S)
ans = 0
for lst in product(["+",""], repeat=length-1):
    mystr = ""
    for i in range(length-1):
        mystr += S[i]+lst[i]
    mystr += S[-1]
    mylist = [int(x) for x in mystr.split("+")]
    ans += sum(mylist)
print(ans)


# In[ ]:






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

using namespace std;

typedef pair<int, int> ii;

int main()
{
    int n;
    scanf("%d", &n);

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int l, r;
        scanf("%d %d", &l, &r);

        ans += r - l + 1;
    }

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

    return 0;
}

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

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	array<int,3> a;
	for(int i=0;i<3;++i)
		cin>>a[i];
	sort(a.begin(),a.end());
	cout<<(a[0]+a[1]==a[2]?"Yes\n":"No\n");
}




Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }

int main() {
    ll a, b, k; cin >> a >> b >> k;
    b = max(0LL, b - max(0LL, k - a));
    a = max(0LL, a - k);
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt"); return;
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }
    
    static object process(TextReader input) {
        var spl   = input.ReadLine().Split(' ');
        var h     = int.Parse(spl[0]);
        var w     = int.Parse(spl[1]);
        var k     = int.Parse(spl[2]);

        var tbl = new char[h][];
        var ret = new int[h][];

        var cut = 1;

        var firstIchigoRow = 0;

        for(int i=0; i<h; i++) {
            var s   = input.ReadLine();
            tbl[i] = new char[w];
            ret[i] = new int[w];

            var topIchigo = s.IndexOf('#');
            var lastIchigo = s.LastIndexOf('#');

            for(int j=0; j<w; j++) {
                var ichigo = s[j];
                tbl[i][j] = ichigo;

                if (topIchigo < 0) continue;
                if (firstIchigoRow == 0) firstIchigoRow = i;

                if (ichigo == '.') {
                    if(j >=lastIchigo)
                        ret[i][j] = ret[i][lastIchigo];
                    else
                        ret[i][j] = cut;
                } else {
                    ret[i][j] = cut;
                    cut++;
                }
            }
        }
        //空っぽ列の埋め
        int setrow = firstIchigoRow;
        for (int i = 0; i < h; i++) {
            if (ret[i][0] != 0) {
                setrow = i;
                continue;
            }
            for(int j=0; j<w; j++) {
                ret[i][j] = ret[setrow][j];
            }
        }

        var buil = new StringBuilder();
        foreach(var i in ret) {
            foreach(var j in i) {
                buil.Append(j);
                buil.Append(' ');
            }
            buil.AppendLine();
        }

        return buil.ToString();
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl =strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


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

int N, M;
struct City {
	ll Y;
	int P;
	int n;
	int x;
};
City C[100010];
int x[100010];

int main()
{
	cin >> N >> M;
	for (int i = 0; i < M; ++i) {
		cin >> C[i].P >> C[i].Y;
		C[i].n = i;
	}
	sort(C, C + M, [](City const& l, City const& r) {
		return l.Y == r.Y ? l.P < r.P : l.Y < r.Y;
	});
	for (int i = 0; i < M; ++i) {
		auto p = C[i].P;
		C[i].x = ++x[p];
	}
	sort(C, C + M, [](City const& l, City const& r) {
		return l.n < r.n;
	});
	for (int i = 0; i < M; ++i) {
		cout << setfill('0') << setw(6) << C[i].P
			 << setfill('0') << setw(6) << C[i].x << endl;
	}
	return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;

int main() { 
    int n;
    map< long long int, long long int > ret;
    long long ans = 1;
    cin >> n;
    for(int j = 2; j <= n; ++j) {
        int k = j;
        for(long long int i = 2; i * i <= k; i++) {
            while(k % i == 0) {
                ret[i]++;
                k /= i;
            }
        }
        if(k != 1) ret[k]++;
    }

    auto begin = ret.begin(), end = ret.end();
    for(auto iter = begin; iter != end; iter++) {
        ans *= iter->second + 1;
        ans %= MOD;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int maxn = 5e6+5;
const ll inv2 = 500000004;
int main()
{
    int n; scanf("%d",&n);
    int res=n/500*1000+(n%500)/5*5;
    cout<<res<<endl;
}

Measured memory_bytes: 256
//#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N;
	cin >> N;
	VI A(N);
	bool negflag = false;
	for (int n = 0; n < N; n++) {
		cin >> A[n];
		if (A[n] < 0)negflag = true;
	}
	if (!negflag) {
		cout << N - 1 << "\n";
		for (int n = 1; n < N; n++)cout << n << " " << n + 1 << "\n";
		return 0;
	}
	int mi = 0, ma = 0;
	for (int n = 1; n < N; n++) {
		if (A[mi] > A[n])mi = n;
		if (A[ma] < A[n])ma = n;
	}
	cout << 2 * N - 2 << "\n";
	if (A[ma] > -A[mi]) {
		for (int n = 0; n < N; n++) {
			if (n == ma)continue;
			cout << ma + 1 << " " << n + 1 << "\n";
		}
		for (int n = 1; n < N; n++) {
			cout << n << " " << n + 1 << "\n";
		}
	}
	else {
		for (int n = 0; n < N; n++) {
			if (n == mi)continue;
			cout << mi + 1 << " " << n + 1 << "\n";
		}
		for (int n = N; n >= 2; n--) {
			cout << n << " " << n - 1 << "\n";
		}
	}
	return 0;
}


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

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

int main(void)
{
    string s;
    cin>>s;
    if(s=="AAA"||s=="BBB") cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

}

Measured memory_bytes: 256