akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define ss second
#define ff first
#define INF 300000000000001
#define ll_max 9000000000000000001
#define mod 998244353
#define PI 3.14159265358979323846L
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define db(args...) {string _ss = #args; replace(_ss.begin(), _ss.end(), ',' , ' '); stringstream ___s(_ss) ; debug(___s, args);}
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll;
const ll N = 300001;
const ll M = 1;
struct point {
    ll x, y;
    ll i;
};

void debug(stringstream &s){}
template <typename T, typename... Args>
void debug(stringstream &s, T a, Args... args)
{
    string word;
    s >> word;
    cout << word << " = " << a << endl;
    debug(s, args...);
}

ll fast_exp(ll x, ll n)
{
    if(n == 0) return 1;
    else if(n & 1)
        return fast_exp(x, n - 1) * x % mod;
    else
    {
        ll tmp = fast_exp(x, n >> 1);
        return tmp * tmp % mod;
    }
}

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    //int test = 0;
    while(_--)
    {
        ll n, m, x = 0, y = 0, k;
        cin >> n >> m >> x >> y;
        n = (n + y - 1) / y;
        x = (x + m - 1) / m;
        if(x <= n)
            cout << "Yes";
        else cout << "No";
    }
    return 0;
}


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

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

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

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

// -------------------------------------------------------
string c[2];

int main() {
  cin >> c[0] >> c[1];
  rep(i, 0, 3) {
    if (c[0][i] != c[1][2 - i]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<n;i++)
#define REP1(i,n) for(long long i=1;i<=n;i++)
#define REPB(i,n) for(long long i=((n)-1);i>=0;i--)
#define REPB1(i,n) for(long long i=(n);i>0;i--)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();ite++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
typedef long long ll;
typedef pair<int,int> pii;
//---------------------
#define MAXN 100000
//---------------------
int main(){
	string s,t;
	cin>>s>>t;
	sort(ALL(s));
	sort(ALL(t));
	reverse(ALL(t));
	if(s<t) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
s = input()
q = int(input())
s1 = ""
s2 = ""
c = 1
for i in range(q):
  a = input()
  if " " in a:
    l = list(a.split())
    c2 = 3-2*int(l[1])
    if c*c2 == 1:
      s1 = s1 + l[2]
    else:
      s2 = s2 + l[2]
  else:
    c = -c
s = s1[::-1] + s + s2
if c == 1:
  print(s)
else:
  print(s[::-1])

Measured memory_bytes: 10224
N, K = map( int, input().split())
ANS = [0]*(N+1)
for i in range(1,N+1):
    if i >= K:
        ANS[i] = 1
    a = i
    t = 0
    while a < K:
        a *= 2
        t += 1
    ANS[i] = 2**(-t)
print(sum(ANS)/N)


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a,b,c;
	cin >> a >> b ;
	if ( a >9){
		cout << -1 <<endl;
	}else if ( b > 9 ){
		cout << -1 << endl;
	}else if ( b>9 && a> 9){
		cout << -1 << endl;
	}else {
		cout << a*b << endl;
	}
	
	

}


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

#define ll long long
#define deb(x) cerr << #x << ":" << x << "\n"
#define all(x) x.begin(),x.end()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int ll
int n,w;
vector<pair<int,int>> v(105);
vector<vector<int>> dp(105,vector<int>(100005,-1));

int max_val(int ind,int w){
    if(ind<0)return 0;
    if(w<0)return INT64_MIN;
    if(dp[ind][w]!=-1)return dp[ind][w];
    dp[ind][w]=max_val(ind-1,w);
    if(w-v[ind].first>=0)dp[ind][w]=max(dp[ind][w],v[ind].second+max_val(ind-1,w-v[ind].first));
    return dp[ind][w];
}

void solve()
{
    cin>>n>>w;
    for(int i=0;i<n;i++){
        cin>>v[i].first>>v[i].second;
    }
    cout<<max_val(n-1,w)<<"\n";
}

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

Measured memory_bytes: 86216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

struct edge{ll to,cost;};
int V;
vector<edge> G[255000];
ll d[255000];

void dijkstra(int s){
    priority_queue<pii,vector<pii>,greater<pii>> que;
    fill(d,d+V,INF);
    d[s]=0;
    que.push(pii(0,s));
    while(!que.empty()){
        pii p=que.top();
        que.pop();
        int v=p.S;
        if(d[v]<p.F)continue;
        rep(i,sz(G[v])){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(pii(d[e.to],e.to));
            }
        }
    }    
}

int main() {
    int n;
    cin >> n;
    V=255000;
    int m,s;
    cin >> m >> s;
    if(s>=2500)s=2500;
    rep(i,m){
        int u,v,a,b;
        cin >> u >> v >> a >> b;
        u--;
        v--;
        for(int j=a;j<=2500;j++){
            G[j*100+u].pb({(j-a)*100+v,b});
            G[j*100+v].pb({(j-a)*100+u,b});
        }
    }
    rep(i,n){
        ll c,e;
        cin >> c >> e;
        rep(j,2500){
            G[j*100+i].pb({min((j+c)*100,(ll)250000)+i,e});
        }
    }
    dijkstra(s*100);
    for(int i=1;i<n;i++){
        ll mn=INF;
        rep(j,2501){
            chmin(mn,d[j*100+i]);
        }
        cout << mn << endl;
    }


}

/*



 */




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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll ;

const ll inf = 1e18 + 17;
const int maxn = 3e3 + 10;
const int maxq = 1e2 + 10;
const int alf = 26;
const ll dlm = 1e9 + 7;
const int del = 998244353 ;
const int eps = 1e-7 ;

double p[maxn];
double dp[maxn][maxn];

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        double f;
        cin>>f;
        p[i] = f;
    }
    dp[0][0] = 1.;
    for(int i=1;i<=n;i++){
        double f = p[i];
        dp[i][0] = dp[i-1][0] * (1-f);
        for(int j=1;j<=i;j++){
            dp[i][j] = (dp[i-1][j-1]*f) + (dp[i-1][j]*(1.-f));
        }
    }
    double ans = 0.;
    for(int i=n/2+1;i<=n;i++){
        ans += dp[n][i] ;
    }
    cout<<fixed<<setprecision(10)<<ans;
    return 0;
}


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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

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

  int n; cin >> n;
  cout << n / 3 << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define ll long long
#define mod 1000000007

int main () {
  ll n, k;
  cin >> n >> k;
  ll a[n + 1], dp[n + 1][k + 1], sum[n + 1][k + 1];
  for (ll i = 1; i <= n; i++) {
    for (ll j = 0; j <= k; j++) {
      dp[i][j] = 0;
      sum[i][j] = 0;
      sum[0][j] = 1;
      dp[0][j] = 0;
    }
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (ll i = 1; i <= n; i++) {
    for (ll j = 0; j <= k; j++) {
      // j個数ある状態でありここから，
      ll now = j;
      if (now >= a[i]) now = a[i];
      // 0 ~ now個数まで使う
      if (j - now != 0) {
        dp[i][j] = (sum[i - 1][j] - sum[i - 1][j - now - 1] + mod) % mod;
      }
      else {
        dp[i][j] = sum[i - 1][j] % mod;;
      }
      sum[i][j] = dp[i][j];
      if (j != 0) sum[i][j] = (sum[i][j - 1] + sum[i][j]) % mod;
    }
  }
  cout << dp[n][k] << endl;
}

Measured memory_bytes: 158080
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
// ll n;

ll height(ll x, ll y, ll h, ll cx, ll cy){
    return max(h - abs(x-cx) - abs(y-cy),ll(0));
}

int main(void) {
    ll n;
    cin >> n;
    ll xyh[3][100]={};
    ll h=0;
    rep(i,n){
        cin >> xyh[0][i] >> xyh[1][i] >> xyh[2][i];
        if(xyh[2][i]>h)h=xyh[2][i];
    }
    ll res[2]={};
    rep(i,101){
        rep(j,101){
            for(ll k=h;k<h+200;k++){
                bool ok = true;
                rep(l,n){
                    if(height(i,j,k,xyh[0][l],xyh[1][l])!=xyh[2][l]){
                        ok=false;
                        break;
                    }
                }
                if(ok){
                    printf("%d %d %lld\n",i,j,k);
                    return 0;
                }
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;

int main()
{
    // 整数の入力
    string x;
    cin >> x;
    if (x[x.size() - 1] == 's'){
        cout << x << "es" << endl;
    }else{
        cout << x << "s" << endl;
    }
    return 0;
}

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

int main() {
  string B;
  cin >> B;
  
  if (B == "A") {
    cout << "T" << endl;
  } else if (B == "T") {
    cout << "A" << endl;
  } else if (B == "G") {
    cout << "C" << endl;
  } else {
    cout << "G" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#define MAX_N 40

int n;
int preorder[MAX_N];
int inorder[MAX_N];
int post[MAX_N];
int n_post;
int pos;

int
distance(int x)
{
	int i;

	for (i = 0; i < n; ++i)
	{
		if (inorder[i] == x)
			return i;
	}

	return -1;
}

void
rec(int l, int r)
{
	if (l >= r)
		return;

	int root = preorder[pos++];
	int m = distance(root);
	rec(l, m);
	rec(m + 1, r);
	post[n_post++] = root;
}

void
solve()
{
	int i;

	pos = 0;
	rec(0, n);
	for (i = 0; i < n_post; ++i)
		printf("%d%c", post[i], (i != n_post - 1) ? ' ' : '\n');
}

int
main(int argc, char** argv)
{
	int i;

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

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

	solve();
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	string str;
	int num=0;
	cin >> str;
	for(int i=0;i<str.size();i++){
		if(str[i]=='+')	num++;
		else	num--;
	}
	cout << num << endl;
	return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

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

    int A, B;
    std::cin >> A >> B;

    int res = 0;

    if(A <= 5){
        res = 0;
    }else if(A <= 12){
        res = B / 2;
    }else{
        res = B;
    }

    std::cout << res << std::endl;
}


Measured memory_bytes: 256
N,K = [ int(it) for it in input().split() ]
li =[ int(it) for it in input().split() ]

p = li.index(1)
a = p
b = N-1-p

smin = 10000000000000
for i in range(K):
  s = 1
  x = a-i
  y = b-(K-1-i)
  if (x<0):
    continue
  if (y<0):
    continue
  s+=(x+(K-2))//(K-1)
  s+=(y+(K-2))//(K-1)
  smin = min(s,smin)
print (smin)
  


Measured memory_bytes: 52476
#include <iostream>

using namespace std;

bool func(string s, int l, int r) {
    bool ret=true;
    for(int i=l; i<(l+r)/2; i++) {
        if(s[i]!=s[r-1-i]) {
            ret=false;
            break;
        }
    }
    
    return ret;
}

int main() {
    string str;
    cin >> str;
    
    bool flag=true;
    flag = func(str, 0, str.size());
    if(flag) {
        flag = func(str, 0, (str.size()-1)/2);
    }
    if(flag) {
        flag = func(str, (str.size()+3)/2, str.size());
    }

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

    return 0;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi first
#define se second
#define gcd __gcd
#define maxe *max_element
#define mine *min_element
#define deb debug
 
#define forz(i,n) for(long long int i=0;i<n;i++)
#define rep(i,k,n) for (lli i = k; i <= n; i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)
 
typedef pair <lli,lli> pll;
 
 
lli countGreater(lli arr[], lli n, lli k) 
{ 
    lli l = 0; 
    lli r = n - 1; 
  
    // Stores the index of the left most element 
    // from the array which is greater than k 
    lli leftGreater = n; 
  
    // Finds number of elements greater than k 
    while (l <= r) { 
        lli m = l + (r - l) / 2; 
  
        // If mid element is greater than 
        // k update leftGreater and r 
        if (arr[m] > k) { 
            leftGreater = m; 
            r = m - 1; 
        } 
  
        // If mid element is less than 
        // or equal to k update l 
        else
            l = m + 1; 
    } 
  
    // Return the count of elements greater than k 
    return (n - leftGreater); 
}
 
bool is_palin(string input)
{
if (input == string(input.rbegin(), input.rend())) 
    return true;
return false;
}
void solve()
{
    set<string> se;
    lli n;cin>>n;
    forz(i,n)
    {
        string s;cin>>s;
        se.insert(s);
    }
    cout<<se.si<<endl;
}
 
int main()
{
    kira; 
 
    lli t=1; //cin>>t;
    while(t--)
    {
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 19220
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        string s = Console.ReadLine();
        if ("AAA".Equals(s) || "BBB".Equals(s))
        {
            Console.WriteLine("No");
        }
        else
        {
            Console.WriteLine("Yes");
        }
    }
}

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

def main():
     k = int(input())

     runrun = [1, 2, 3, 4, 5, 6, 7, 8, 9]
     count = 0
     while(len(runrun) < k):
          target = runrun[count]
          runrun.extend(make(target))
          count += 1
          # print(runrun)

     print(runrun[k-1])

def make(n):
     num = n % 10
     if num == 0:
          return [n * 10 + num, n * 10 + num + 1]
     elif num == 9:
          return [n * 10 + num - 1, n * 10 + num]
     else:
          return [n * 10 + num - 1, n * 10 + num, n * 10 + num + 1]

if __name__ == "__main__":
    main()


Measured memory_bytes: 7144
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;
long long modpow(long long x,long long n,long long mod)
{
  if(n==0)return 1;
  long long res=modpow(x*x%mod,n/2,mod);
  if(n&1)res=res*x%mod;
  return res;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  int mod=1e9+7;
  vector<int>cnt(n);
  rep(i,n){
    cnt[a[i]]++;
  }
  if(n%2){
    int f=1;
    if(cnt[0]!=1)f=0;
    rep(i,n){
      if(i==0)continue;
      if(i%2)continue;
      if(cnt[i]!=2)f=0;
    }
    if(f){
      cout<<modpow(2,n/2,mod)<<endl;
      return 0;
    }
  }
  else {
    int f=1;
    rep(i,n){
      if(i%2==0)continue;
      if(cnt[i]!=2)f=0;
    }
    if(f){
      cout<<modpow(2,n/2,mod)<<endl;
      return 0;
      
    }
  }
  cout<<0<<endl;

  return 0;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
 
#define REP(i, n) for(int i = 0; i < (n); i++)
#define SREP(i, s) for(int i = 0; i < (s.size()); i++)
#define SORT(v, n) sort(v, v+n);
#define GSORT(v, n) sort(v, v+n, greater<int>());
#define VSORT(v) sort(v.begin(),v.end());
#define VGSORT(v) sort(v.begin(),v.end(),greater<int>());
#define REV(a) reverse(begin(a),end(a));

int main(){
	ios::sync_with_stdio(false);cin.tie(0);
////////////////////////////////////////////
	string s,t;
	cin >> s >> t;

	VSORT(s);
	VGSORT(t)
	cout << (s<t ? "Yes" : "No") << endl;
/////////////////////////////////////////////
}


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

class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int sum=0;
        String s;
        int num1=0,num2=0;
        while((s=br.readLine())!=null){
            String[] str = s.split(" ");
            num1 = Integer.parseInt(str[0]) * Integer.parseInt(str[1]);
            num2 = (Integer.parseInt(str[0]) + Integer.parseInt(str[1]))*2;
        }
        System.out.println(num1 +" "+num2);
    }
}

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

int main() {
    int a,b,c,x,y,ans,hoge;
    cin>>a>>b>>c>>x>>y;
    ans = a*x + b*y;
    ans = min(ans,2*c*max(x,y));
    if(x>=y){
        ans = min(2*c*y + a*(x-y),ans);
    }else{
        ans = min(2*c*x + b*(y-x),ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
Edge=[[int(i) for i in input().split()] for i in range(M)]
Vertex=[]
X=[]
n=1
a=0
while n<=N:
  while a<=M-1:
    if n in Edge[a]:
      X=X+Edge[a]
    a+=1
  X=[item for item in X if item!=n]
  Vertex.append(X)
  n+=1
  a=0
  X=[]
Choices=[[1]]
m=0
for i in Choices:
    if len(i)>=N:
      break
    for j in Vertex[i[len(i)-1]-1]:
      Choices.append(i+[j])
Choices=[item for item in Choices if len(item)==N]
a=1
while a<=N:
  Choices=[item for item in Choices if item.count(a)==1]
  a+=1
print(len(Choices))
      
    

Measured memory_bytes: 150900
package main

import (
	"fmt"
)

func isNum(c rune) bool {
	return '0' <= c && c <= '9'
}

func main() {
	var a, b int
	var s string
	fmt.Scan(&a, &b, &s)

	var len int
	var hyphenFound bool
	for i, v := range s {
		len++
		if !isNum(v) {
			if v == '-' && i == a {
				hyphenFound = true
				continue
			} else {
				fmt.Println("No")
				return
			}
		}
	}

	if len == a+b+1 && hyphenFound {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <stdio.h>
int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a==b){
		if(a!=c)printf("Yes\n");
		else printf("No\n");
	}else if(a==c){
		if(a!=b)printf("Yes\n");
		else printf("No\n");
	}else if(b==c){
		if(a!=b)printf("Yes\n");
		else printf("No\n");
	}else printf("No\n");
	return 0;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    string s;
    cin >> s;
    int r = 0, b = 0;
    int ans = 0;
    REP(i,SZ(s)){
        if(s[i]=='0'){
            if(b>0){
                b--;
                ans++;
            }else {
                r++;
            }
        }else{
            if (r > 0)
            {
                r--;
                ans++;
            }
            else
            {
                b++;
            }
        }
    }
    cout << ans*2 << "\n";
    return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;
constexpr double PI = 3.141592653589793;
constexpr ll INF = 1e18 + 10;

using namespace std;
//    cout << setprecision(20) << ans << "\n";

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

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    int gcd = a[0];
    for (int i = 1; i < n; i++)
    {
        gcd = __gcd(a[i], gcd);
    }
    cout << gcd << "\n";

    return 0;
}

Measured memory_bytes: 640
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
using System.IO.Pipes;
using System.Threading;

class Program
{
    static char[] abc = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
    static long mod = 1000000007;
    static void Main(string[] args)
    {
        var S = Console.ReadLine().ToList();
        var N = S.Count();
        //var N = long.Parse(Console.ReadLine());
        //var NT = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var dic = new Dictionary<char, int>();

        for (int i = 0; i < N; i++)
        {
            dic.Add(S[i], 1);
        }
        var ans = false;

        foreach (var item in abc)
        {
            if (!dic.ContainsKey(item))
            {
                S.Add(item);
                ans = true;
                break;
            }
        }

        var dic2 = new Dictionary<char, int>();
        if (!ans) {
            for (int i = N - 1; !ans && i >= 0; i--)
            {
                dic2.Add(S[i], 1);
                foreach (var item in dic2)
                {
                    if (item.Key > S[i])
                    {
                        S[i] = item.Key;
                        ans = true;
                        break;
                    }
                }
                if(!ans) S.RemoveAt(S.Count - 1);
            }
        }

        Console.WriteLine(ans ? String.Join("",S) : "-1");

    }

}

Measured memory_bytes: 26736
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int n, m;
	cin >> n >> m;
	int cnt[n];
	for(int i=0; i<n; i++) cnt[i] = 0;

	int a, b;
	for(int i=0; i<m; i++){
		cin >> a >> b;
		cnt[a-1]++;
		cnt[b-1]++;
	}

	for(int i=0; i<n; i++) cout << cnt[i] << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) cout << (x) << endl;
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};



int main(void){
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int n;
    cin >> n;
    for(int i = 1; i < 10; ++i){
      if(n / i >= 1 && n / i <= 9){
        if(n % i == 0){
          print("Yes");
          return 0;
        }
      }
    }
    print("No");
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
int n,x,y,ans[2005];
int main(){
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<=n;i++){
		for(int k=1;k<=n-1;k++){
			int x1=i+k,x2=y-(k-abs(x-i)-1),x3=y+(k-abs(x-i)-1);
			if(x1<=n&&abs(x-i)+1+abs(x1-y)>=k) ans[k]++;
			if(k-abs(x-i)-1==0){
				if(y>i&&y-i>k) ans[k]++;
				continue;
			}
			if(k-abs(x-i)-1<0) continue;
			if(x2>i&&x2-i>k) ans[k]++;
			if(x3<=n&&x3-i>k) ans[k]++;
		}
	}
	for(int k=1;k<=n-1;k++) printf("%d\n",ans[k]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    set <string> s;
    while(n--){
        string st;
        cin>>st;
        s.insert(st);
    }
    cout<<s.size();
    return 0;
}

Measured memory_bytes: 19284
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
#define maxn 10001000

int a[110],n,ans=maxn;
int mymin(int x,int y){return (x<y)?x:y;}
int ck(int x)
{
	int ret=0;
	for (int i=1;i<=n;i++)
	{
	 	ret+=(x-a[i])*(x-a[i]);
		if (ret>ans) break;
	}return ret;
}
int main()
{
	int x,i;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	for (x=-100;x<=100;x++)
	  ans=mymin(ans,ck(x));
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
n = int(input())
al = list(map(int,input().split()))

from collections import defaultdict
dic = defaultdict(int)


for a in al:
    dic[a] += 1

if dic[1]:
    if dic[1] == 1:
        print(1)
    else:
        print(0)
    exit()

al = sorted(al)
from math import sqrt
M = 10**6+1
p = [1]*(M+1)
p[0] = p[1] = 0
ans = 0
for x in al:
    if p[x]:
        if dic[x] == 1:
            ans += 1
        for y in range(x, M+1, x):
            p[y] = 0

print(ans)



Measured memory_bytes: 116420
def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a%b)

def lcm(a, b):
	return (a*b)//gcdc(a, b)

n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
t = l[0]
for i in range(1, n):
	t = (t*l[i])//gcd(t, l[i])
print(t)

Measured memory_bytes: 3060
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main(void){
    int n;
    string s,t;
    map<string,int> msi;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s>>t;
        if(s=="insert"){
            msi[t]=1;
        }
        else{
            if(msi.find(t)==msi.end()) cout<<"no"<<endl;
            else cout<<"yes"<<endl;
        }
    }
    return 0;
}

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

const ll INF = 1e18;
const int MX = 2005;

int main() {
  string S;
  cin >> S;
  if(S =="ABC"){
    cout << "ARC" << endl;
  }else{
    cout<< "ABC" << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int r,g,b,n;
int cnt;
int main(){
	cin>>r>>g>>b>>n;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			if((n-r*i-g*j)%b==0&&n>=r*i+g*j){
				cnt++;
			}
		}
	}
	cout<<cnt;
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 5000010
int main()
{
	int n;cin>>n;
	ll sum=0;
	for(int i=1;i<=n;i++)
	{
		if(i%3==0||i%5==0) continue;
		sum+=i;
	 } 
	 cout<<sum<<endl;
	return 0;
}


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

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

#define mem(x, y) memset(x, y, sizeof(x))
#define mp make_pair
#define pb push_back

int main() {
    ll N, K, ans, min, max, tmp;
    cin >> N >> K;
    ll A[200003];
    mem(A, 0);

    for(ll i = 1; i <= N; i++) {
        A[i] = A[i - 1] + i;
    }

    for(ll i = K; i <= N; i++) {
        min = A[i - 1];
        max = A[N] - A[N - i];
        ans += max - min + 1;
    }
    ans += 1;

    cout << ans % 1000000007<< endl;

    return 0;
}

Measured memory_bytes: 5184
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

bool cmp(pair<int, int> p1, pair<int, int> p2) {
  return p1.first != p2.first ? p1.first < p2.first : p1.second > p2.second;
}

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

  int n;
  cin >> n;
  vector<pair<int, int>> p(n);
  rep(i, n) cin >> p[i].first >> p[i].second;

  sort(p.begin(), p.end(), cmp);
  vector<int> minr(n - 1);
  int res = p[n - 1].second;
  repr(i, n - 2) {
    minr[i] = res;
    chmin(res, p[i].second);
  }
  int ans = 0;
  res = inf;
  rep(i, n - 1) {
    int sum = 0;
    int sum1 = min(res, p[i].second) - p[i].first + 1;
    chmax(sum1, 0);
    sum += sum1;
    int sum2 = minr[i] - p[n - 1].first + 1;
    chmax(sum2, 0);
    sum += sum2;
    chmax(ans, sum);
    sum = 0;
    sum1 = p[i].second - p[i].first + 1;
    chmax(sum1, 0);
    sum += sum1;
    sum2 = min(res, minr[i]) - p[n - 1].first + 1;
    chmax(sum2, 0);
    sum += sum2;
    chmax(ans, sum);
    chmin(res, p[i].second);
  }
  cout << ans << '\n';






  
  return 0;
}

Measured memory_bytes: 1408
n = int(input())
cnt = 0


def gcd(a,b,c):
    while b != 0:
        a, b = b, a % b
    while c != 0:
        a, c = c, a % c
    return a


for i in range(1,n+1):
    for j in range(i, n+1):
        for k in range(j, n+1):
            if i == j and j == k:
                cnt += gcd(i,j,k)
            elif i == j or j == k or k == i:
                cnt += gcd(i, j, k)*3
            else:
                cnt += gcd(i, j, k)*6
print(cnt)


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


void main()
{
  auto s = readln.chomp.to!int;
  auto u2 = s / 100;
  auto d2 = s % 100;
  bool uf, df;
  if (u2 >= 1 && u2 <= 12) {
    uf = true;
  }
  if (d2 >= 1 && d2 <= 12) {
    df = true;
  }
  if (uf && df) {
    writeln("AMBIGUOUS");
  } else if (uf) {
    writeln("MMYY");
  } else if (df) {
    writeln("YYMM");
  } else {
    writeln("NA");
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
int data_w[100];
int data_v[100];
long long dp[101][100001] ={0};

long long max( long long a, long long b)
{
	return (a >= b) ? a : b;
}

int main()
{
	int N,W;

	cin >> N >> W;
	for(int i=0; i<N; i++){
		cin >> data_w[i] >> data_v[i] ;
	}

	for(int n=0; n < N; n++){
		for( int w=0; w <= W ;w++)
		{
			if( data_w[n] > w )
			{
				{
					dp[n+1][w] = dp[n][w];						
				}
			}
			else
			{
				long long v1 = dp[n][w];
				long long v2 = dp[n][w-data_w[n]]+data_v[n];
				dp[n+1][w] = max(v1,v2);
			}
		}
	}

	cout << dp[N][W] << endl;
	return 0 ;
}

Measured memory_bytes: 78336
a=list(map(int,input().split()))
ans=3
if a[0]==a[1] and a[1]==a[2]:
  ans=1
else:  
  for i in range(0,2):
    for j in range(i+1,3):
      if a[i]==a[j]:
        ans = 2
        break
      else:
        j += 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#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 ALL(v) (v).begin(), (v).end()

int h, w, m[1005][1005], ans = 0;
P pos[1000005];
set<int> cnt[1005][1005];

int main() {
    cin >> h >> w;
    REP(i,h)REP(j,w){
        scanf("%d",&m[i][j]);
        pos[m[i][j]-1] = {i,j};
    }
    REP(k,h*w){
        int i = pos[k].first, j = pos[k].second;
        if(cnt[i][j].size()>=2) ans++;
        else if(cnt[i][j].size()==0) cnt[i][j].insert(k);
        REP(l,4){
            int ni = i+di[l], nj = j+dj[l];
            if(ni<0 || ni>=h)continue;
            if(nj<0 || nj>=w)continue;
            if(m[ni][nj] > m[i][j]){
                cnt[ni][nj].insert(cnt[i][j].begin(),cnt[i][j].end());
            }
        }
        cnt[i][j].clear();
    }
    cout << ans << endl;
    return 0;
}



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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int ans;
    if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) ans = 0;
    else if (a == b && b == c) ans = -1;
    else {
        ans = 0;
        while(a % 2 != 1 && b % 2 != 1 && c % 2 != 1) {
            int na = b/2 + c/2;
            int nb = c/2 + a/2;
            int nc = a/2 + b/2;
            a = na, b = nb, c = nc;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<61;
const double EPS=1e-9;
const int MOD=1e9+7;
int main(){
    int h,w;cin>>h>>w;swap(h,w);
    int n;cin>>n;
    if(n==0){
        cout<<w<<endl;
        return 0;
    }
    vector<pair<P,int>> v;
    map<P,int> mp;
    for(int i=0;i<n;i++){
        int x,y;cin>>x>>y;x--;y--;
        mp[P(x+1,y)]++;
        mp[P(x-1,y)]++;
        mp[P(x,y-1)]++;
        v.push_back(make_pair(P(y,x),0));
    }
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        P p=itr->first;
        if(itr->second>=3&&p.first>=0&&p.second>=0){
            v.push_back(make_pair(P(p.second,p.first),1));
        }
    }
    sort(all(v));
    v.erase(unique(all(v)),v.end());
    ll ans=w;
    int co=0;
    for(int i=0;i<n;i++){
        ll y=v[i].first.first,x=v[i].first.second;
        if(x<y+co)continue;
        if(x==y+co){
            co++;continue;
        }
        if(v[i].second){
            ans=min(ans,x);
            continue;
        }
        ans=min(ans,x);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 43180
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	int cost = 0;
	for (int i = 0; i < n; ++i)
	{
		if (i == 0)
		{
			cost += abs(a[i] - 0);
			continue;
		}
		if (i == n - 1)
		{
			cost += abs(a[i] - 0) + abs(a[i] - a[i - 1]);
			continue;
		}
		cost += abs(a[i] - a[i - 1]);
	}
	for (int i = 0; i < n; ++i)
	{
		if (i == 0)
		{
			cout << cost - abs(a[i] - 0) - abs(a[i] - a[i + 1]) + abs(a[i + 1] - 0)<<endl;
			continue;
		}
		if (i == n - 1)
		{
			cout << cost - abs(a[i] - 0) - abs(a[i] - a[i - 1])+abs(a[i-1]-0) << endl;
			continue;
		}
		cout << cost - abs(a[i] - a[i - 1]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1])<<endl;
	}
}

Measured memory_bytes: 1664
import java.util.*;
import java.lang.*;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long m = sc.nextLong();
		if (m % 2 == 1) {
			m--;
		}
		if (n >= m / 2) {
			System.out.println(m / 2);
		} else {
			m -= 2 * n;
			System.out.println(n + m / 4);
		}
	}
}

Measured memory_bytes: 22868
import math

AB = input().split()
A = int(AB[0])
B = int(AB[1])

# floor(0.08*x)=A
# floor(0.1*x)=B
# means
# A <= 0.08*x < A+1
# B <= 0.1*x < B+1
# therefore
# A/0.08 <= x < (A+1)/0.08
# B/0.1 <= x < (B+1)/0.1

x_lower1 = A/0.08
x_lower2 = B/0.1
x_upper1 = (A+1)/0.08
x_upper2 = (B+1)/0.1

x_lower = max(x_lower1, x_lower2)
x_upper = min(x_upper1, x_upper2)

x_candidate = math.ceil(x_lower)
if x_candidate < x_upper:
  print(int(x_candidate))
else:
  print(-1)


Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
    int a,b,A=0,B=0;
    scanf("%d %d",&a,&b);
    
    if (a>b) {
        for (int i=0;i<a;i++) {
            B=B*10+b;
        }
        printf("%d",B);
    }
    else {
        for (int i=0;i<b;i++) {
            A=A*10+a;
        }
        printf("%d",A);
    }

    return 0;
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<v.size()-1) cout<<sep;} cout<<endl

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

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin>>n;
    vi p(n);
    int max = -1;
    REP(i,n){
        cin>>p[i];
        if(max<p[i]) max = p[i];
    }

    int ans = accumulate(ALL(p),0);
    cout << ans - (max/2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int H,W;cin >> H >> W;
  vector<vector<int> > maze(W,vector<int>(H));
  rep(y,H)rep(x,W) cin >> maze[x][y];
  rep(y,H)rep(x,W){
    int B;cin >> B;
    maze[x][y] = abs(maze[x][y] - B);
  }
  int M = 80*160;
  vector<vector<bool> > pre(W+1,vector<bool>(M,false));
  vector<vector<bool> > nxt(W+1,vector<bool>(M,false));
  pre[0][0] = true;
  rep(y,H){
    rep(x,W){
      rep(i,M) nxt[x][i] = false;
      rep(i,M){
        if(pre[x][i]){
          nxt[x][abs(maze[x][y] - i)] = true;
          if(maze[x][y]+i < M)nxt[x][maze[x][y] + i] = true;
        }
        if(x != 0 && nxt[x-1][i]){
          nxt[x][abs(maze[x][y] - i)] = true;
          if(maze[x][y]+i < M)nxt[x][maze[x][y] + i] = true;
        }
      }
    }
    swap(nxt,pre);
  }
  swap(nxt,pre);
  int m = M;
  rep(i,M) if(nxt[W-1][i]) m = min(m,i);
  cout << m << endl;

  return 0;
}


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

int main(){
	int N, M;
	cin >> N >> M;
	int lines[M][2];
	int have_lines[N];
	for(int i = 0; i < N; i++){
		have_lines[i] = 0;
	}
	for(int i = 0; i < M; i++){
		cin >> lines[i][0];
		cin >> lines[i][1];
		have_lines[lines[i][0] - 1]++;
		have_lines[lines[i][1] - 1]++;
	}
	int ans = 0;
	while(true){
		bool if_bridge = false;
		for(int i = 0; i < N; i++){
			if(have_lines[i] == 1){
				have_lines[i]--;
				ans++;
				for(int j = 0; j < M; j++){
					if(lines[j][0] == i + 1){
						have_lines[lines[j][1] - 1]--;
						lines[j][1] = -1;
						break;
					}
					if(lines[j][1] == i + 1){
						have_lines[lines[j][0] - 1]--;
						lines[j][0] = -1;
						break;
					}
				}
				if_bridge = true;
				break;
			}
		}
		if(!if_bridge){
			cout << ans << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int hishi=0, tyou=0;
		while(cin.hasNext()){
			String str = cin.next();
			String[] s = str.split(",");
			int a = Integer.parseInt(s[0]);
			int b = Integer.parseInt(s[1]);
			int c = Integer.parseInt(s[2]);
			if(a == b){
				hishi++;
			}
			if(a*a+b*b==c*c){
				tyou++;
			}
			
		}
		System.out.println(tyou);
		System.out.println(hishi);
	}

}

Measured memory_bytes: 12000
#include<iostream>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9+7;

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

  if(n<1000) cout << "ABC" << endl;
  else cout << "ABD" << endl;

  return 0;
}

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

using namespace std;

const int N = 1e5 + 5;

typedef pair <lld, int> iid;
int n, m, b, myri;
lld r, s, c, valu;
priority_queue <iid, vector <iid>, greater <iid> > pq;

void enter() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
        lld temp;
        scanf("%lld", &temp);
        s += temp;
        pq.push(iid(temp, 1));
    }
}

void decrease1() {
    b -= myri;
    s -= myri * valu;
}

void decrease2(int temp) {
    b = 0;
    s = s - myri * valu;
    s = s + temp * c;
    pq.push(iid(c, temp));
}

void decrease3(int temp) {
    s = s - b * valu;
    myri -= b, b = 0;
    s = s + temp * c;
    pq.push(iid(c, temp));
    pq.push(iid(valu, myri));
}

void solve() {
    for (int i = 1; i <= m; i++) {
        scanf("%d%lld", &b, &c);
        int b_now = b;
        r = max(r, s);
        while (pq.size() && b != 0) {
            iid info = pq.top();
            valu = info.first;
            myri = info.second;
            pq.pop();

            if (c > valu) {
                if (b  > myri) decrease1();
                else if (b == myri) decrease2(b_now);
                else if (b  < myri) decrease3(b_now);
            }
            else if (c <= valu && b_now - b != 0) {
                pq.push(iid(c, b_now - b));
                pq.push(iid(valu, myri));
                s = s + c * (b_now - b);
                b = 0;
            }
            else if (c <= valu && b_now - b == 0) {
                pq.push(iid(valu, myri));
                b = 0;
            }
        }
    }
    cout << max(r, s);
}

int main()
{
    //freopen("a.inp", "r", stdin);
    enter();
    solve();
    return 0;
}


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

const ll maxn=300+5;
ll n, a,b,c;
double dp[maxn][maxn][maxn];

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cout<<fixed<<setprecision(9);

    cin>>n;
    rep(i,0,n) {
        ll x; cin>>x;
        if(x==1) a++;
        if(x==2) b++;
        if(x==3) c++;
    }
    rep(i,0,n+1) rep(j,0,n+1) rep(k,0,n+1) {
        if(i+j+k==0) continue;
        dp[i][j][k]=1;
        if(i) dp[i][j][k]+=dp[i-1][j+1][k]*i/n;
        if(j) dp[i][j][k]+=dp[i][j-1][k+1]*j/n;
        if(k) dp[i][j][k]+=dp[i][j][k-1]*k/n;
        dp[i][j][k]/=(i+j+k)/(double)n;
    }
    cout<<dp[c][b][a]<<"\n";
}


Measured memory_bytes: 219392