akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

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

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using P = pair<int, int>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class CNumbersOnACircle {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<int> a(n), b(n);
      rep(i, n) cin >> a[i];
      rep(i, n) cin >> b[i];

      priority_queue<P> que;
      rep(i, n) {
        if (b[i] < a[i]) {
          cout << -1 << endl;
          return;
        } else if (b[i] > a[i]) {
          que.emplace(b[i], i);
        }
      }
      ll ans = 0;
      while(!que.empty()) {
        P p = que.top(); que.pop();
        auto bnow = p.first;
        auto pos = p.second;
        debug(bnow, pos);
        auto b1 = b[(pos+1)%n];
        auto b2 = b[(pos+n-1)%n];
        auto k = b1+b2;

        auto b3 = max(b1, b2);
        if (a[pos] >= b3) {
          auto d = bnow-a[pos];
          if (d%k != 0) {
            cout << -1 << endl;
            return;
          } else {
            ans += d/k;
            b[pos] = a[pos];
          }
        } else {
          auto d = bnow-b3;
          auto r = (d/k)+1;
          ans += r;
          b[pos] = bnow-(r*k);
          if (b[pos] < a[pos]) {
            cout << -1 << endl;
            return;
          } else if (b[pos] > a[pos]) {
            que.emplace(b[pos], pos);
          }
        }
      }
      cout << ans << endl;
    }
};

signed main() {
  CNumbersOnACircle solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3956
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll a[410];
ll cum[410];
ll dp[410][410];//dp[i][j]=[i,j)を1体にまとめるための最小コスト
int flag[410][410];

ll f(int l,int r){
	if(r-l==1)return 0;
	if(flag[l][r])return dp[l][r];
	flag[l][r]=1;
	ll ans=INF;
	rep(k,l+1,r){
		ll temp=f(l,k)+f(k,r)+cum[r]-cum[l];
		ans=min(ans,temp);
	}
	return dp[l][r]=ans;
}

int main(){
	ll n;
	scanf("%lld",&n);
	rep(i,0,n)scanf("%lld",a+i);
	rep(i,0,n)cum[i+1]=cum[i]+a[i];
	printf("%lld\n",f(0,n));
}

Measured memory_bytes: 2176
#include<cstdio>

using namespace std;

char s[100001];
int main(){
	scanf("%s",s+1);
	int n=0,m=0;for(;s[n+1];n++);
	for(int i=1;i<=n;i++)if(s[i]!=s[i-1])m++;
	printf("%d",m-1);
}

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

using namespace std;

int main()
{
  int a, b, c;
  int x, y;
  int ans = 0;

  cin >> a >> b >> c >> x >> y;
  c *= 2;

  if ( a + b > c ) {
    ans += min(x, y) * c;
    if ( x <= y ) {
      y -= x;
      x = 0;
    } else {
      x -= y;
      y = 0;
    }
  }

  if ( a > b ) {
    ans += x * min(a, c);
    x = 0;
    if ( c <= a ) {
     y -= x;
     if ( y < 0 ) {
       y = 0;
     }
    }
    ans += y * min(b, c); 
  } else {
    ans += y * min(b, c);
    y = 0;
    if ( c <= b ) {
      x -= y;
      if ( x < 0 ) {
        x = 0;
      }
    }
    ans += x * min(a, c);
  }

  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 256
import itertools
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
a=0
b=0
count=0

per=[x for x in range(1,n+1)]
per_list=itertools.permutations(per)

for c in per_list:
    d=list(c)
    count+=1
    if d==p:
        a=count

    if d==q:
        b=count
        

print(abs(a-b))        

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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



void solve() {
	double a, b, x; cin >> a >> b >> x;
	if(x >= a * a * b / 2){
		double tan = (2*(b - x/(a*a))/a);
		cout << atan(tan) / pi * 180 << endl;
	}else{
		double tan = a * b * b / 2 / x;
		cout << atan(tan) / pi * 180 << endl;
	}
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4352
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        int[] B = new int[N];
        for (int i=0; i<N; i++) {
            A[i] = sc.nextInt();
        }
        for (int i=0; i<N; i++) {
            B[i] = sc.nextInt();
        }

        int ans = solve4006394(N, A, B);

        System.out.println(ans);
    }

    private static int solve(int N, int[] A, int[] B) {

        List<Integer> pos = new ArrayList<>();
        List<Integer> neg = new ArrayList<>();

        for (int i=0; i<N; i++) {
            if (A[i] - B[i] >= 0) {
                pos.add(A[i] - B[i]);
            } else {
                neg.add(B[i] - A[i]);
            }
        }

        Collections.sort(pos, Collections.reverseOrder());
        Collections.sort(neg, Collections.reverseOrder());

        int count = 0;
        int possum = 0;
        while (neg.size() > 0) {
            count++;
            int value = neg.remove(0);

            // System.err.println("current negative = " + value);
            while (possum < value && pos.size() > 0) {
                possum += pos.remove(0);
                // System.err.println("current pos:" + possum);
                count++;
                if (value <= possum) break;
            }

            if (possum < value) return -1;

            possum -= value;
        }

        return count;
    }

    private static int solve4006394(int N, int[] A, int[] B) {
        List<Long> list = new ArrayList<>();
        long aSum = 0;
        long bSum = 0;

        for (int i=0; i<N; i++) {
            list.add((long)(B[i]-A[i]));
            aSum += A[i];
            bSum += B[i];
        }

        if (aSum < bSum) return -1;
        Collections.sort(list);

        int result = 0;
        long plusSum = 0;
        long minSum = 0;
        for (int i=N-1; i>=0 && list.get(i)>0; i--) {
            plusSum += list.get(i);
            result++;
        }
        for (int i=0; i<N && minSum<plusSum; i++) {
            minSum -= list.get(i);
            result++;
        }

        return result;
    }
}


Measured memory_bytes: 66892
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long int
    #define pb push_back
    #define mp make_pair
    #define mod 1e9+7
    #define sz 100000
    #define f(i,n) for(ll i=0;i<n;i++)
    #define fab(i,a,b) for(ll i=a;i<b;i++)
    #define fr(i,n) for(ll i=n-1;i>=0;i--)
    #define fba(i,b,a) for(ll i=b-1;i>=a;i--)
    #define tc(t) ll t;cin>>t;while(t--)
     
    ll pw(ll x,unsigned ll y) 
    { 
        if (y==0) 
            return 1; 
        else if (y%2==0) 
            return pw(x,y/2)*pw(x,y/2); 
        else
            return x*pw(x,y/2)*pw(x,y/2);
    }
     
    int main() 
    {
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        cout.tie(NULL);
        ll n, k;
        cin >> n >> k;
        double a[n], ex[n];
        f(i, n) {
            cin >> a[i];
            ex[i] = ((a[i] * (a[i] + 1)) / 2 ) / a[i];
        }
        double sum = 0, mx = -1;
        f(i, k) {
            sum += ex[i];
        }
        mx = sum;
        fab(i, 1, n - k + 1) {
            sum -= ex[i - 1];
            sum += ex[i + k - 1];
            mx = max(mx, sum);
        }
        cout << fixed<<setprecision(14) << mx;
        return 0;
    }

Measured memory_bytes: 3328
/*
    author:@bhaskar_8998
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds; 
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;  
typedef long long i64;
typedef vector<int> vi;
typedef vector<long> vl;
typedef pair<int,int>pii;
#define all(A) (A).begin(),(A).end()
#define pb push_back
#define MOD 1000000007
#define fastio() {ios_base::sync_with_stdio(false);cin.tie(NULL);}

int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    fastio();
    clock_t beg=clock();
    int t=1;
    // cin>>t;
    while(t--){
        i64 n;;
        cin>>n;
        i64 h[n];
        unordered_map<i64,i64> m1,m2;
        m1.clear();m2.clear();
        for(int i=0;i<n;i++){
            cin>>h[i];
            m1[i+1-h[i]]+=1;
            m2[i+1+h[i]]+=1;
        }
        i64 ans=0;
        for(auto i:m1)
            if(m2[i.first])                
                ans+=i.second*m2[i.first];
        cout<<ans;
    }

    clock_t end=clock(); 
    fprintf(stderr, "\n%lf sec\n", (double)(end-beg)/(CLOCKS_PER_SEC));
    return 0;
}


    

Measured memory_bytes: 27896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Atcoderrrrrr
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string ans = "NO";
            for(int i = 0; i < s.Length; i++)
            {
                for(int j = 0; j+i <= s.Length; j++)
                {
                    if(s.Remove(i,j)== "keyence")
                    {
                        ans = "YES";
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

using namespace std;
#define int long long
/*                      */    //#undef int
#define INF 1000000009
#define INFL 1000000000000000018ll
#define mod 1000000007ll
#define pb push_back
#define fi first
#define se second
#define mk make_pair
typedef pair<int, int> PA;
typedef pair<pair<int, int> , pair<int, int> > PPA;
typedef priority_queue<int> PQ;
typedef priority_queue<PA, vector<PA>, greater<PA> >PQG;

int N, M;
vector<PA > V[100100];
vector<pair<PA , int> > G;

signed main()
{
    cin >> N >> M;
    for(int i = 1; i <= M; i++){
        int p, y;
        cin >> p >> y;
        V[p].pb(mk(y, i));
    }
    for(int i = 1; i <= N; i++){
        sort(V[i].begin(), V[i].end());
        for(int j = 1; j <= (int)V[i].size(); j++){
            V[i][j - 1].first = j;
            PA v = V[i][j - 1];
            G.pb(mk(mk(v.second, i), v.first));
        }
    }
    sort(G.begin(), G.end());
    for(int i = 0; i < (int)G.size(); i++){
        pair<PA , int> p;
        p = G[i];
        int l = p.fi.se;
        int r = p.se;
        //printf("%lld %lld\n", l, r);
        int cl = l;
        int cr = r;
        int cntl = 0, cntr = 0;
        while(cl){
            cntl++;
            cl /= 10;
        }
        while(cr){
            cntr++;
            cr /= 10;
        }
        for(int j = 0; j < 6 - cntl; j++){
            printf("0");
        }
        printf("%lld", l);
        for(int j = 0; j < 6 - cntr; j++){
            printf("0");
        }
        printf("%lld\n", r);

    }

    return 0;
}
/*




*/



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

#define	EPS		1e-9
#define	pb(a)	push_back(a);

using namespace std;

class Point{
public:
	double x,y;
	Point(){}
	Point(double xx,double yy) : x(xx),y(yy){}
};

Point &operator -=(Point &a,const Point &b)
{
	a.x-=b.x;
	a.y-=b.y;
	return a;
}

Point operator -(const Point &a,const Point &b)
{
	Point c=a;
	c-=b;
	return c;
}

class Line : public vector<Point>{
public:
	Line(const Point &a,const Point &b){
		pb(a);
		pb(b);
	}
};

double cross(const Point &a,const Point &b)
{
	return a.x*b.y-a.y*b.x;
}

bool parallel(const Line &l,const Line &m)
{
	return abs(cross(l[1]-l[0],m[1]-m[0]))<EPS;
}

int main()
{
	int n;	cin>>n;
	while(n--){
		Point p[4];
		for(int i=0;i<4;i++)	cin>>p[i].x>>p[i].y;
		Line l(p[0],p[1]),m(p[2],p[3]);
		cout<<(parallel(l,m)?"YES":"NO")<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int n,m;
vector<int> al[100005];
bool vis[100005];

void dfs(int i){
	if (vis[i]) return;
	vis[i]=true;
	
	for (auto &it:al[i]) dfs(it);
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin.exceptions(ios::badbit | ios::failbit);
	
	cin>>n>>m;
	rep(x,0,m){
		int a,b;
		cin>>a>>b;
		al[a].push_back(b);
		al[b].push_back(a);
	}
	
	int ans=-1;
	rep(x,1,n+1) if (!vis[x]) dfs(x),ans++;
	cout<<ans;
}


Measured memory_bytes: 9716
import sys
sys.setrecursionlimit(200000)
def dfs(n):
    if n in dic.keys():
        return dic[n]
    m = n*d
    m = min(dfs((n//2))+(n-(n//2)*2)*d+a,m)
    m = min(dfs(-(-n//2))+(-(-n//2)*2-n)*d+a,m)
    m = min(dfs((n//3))+(n-(n//3)*3)*d+b,m)
    m = min(dfs(-(-n//3))+(-(-n//3)*3-n)*d+b,m)
    m = min(dfs((n//5))+(n-(n//5)*5)*d+c,m)
    m = min(dfs(-(-n//5))+(-(-n//5)*5-n)*d+c,m)
    dic[n] = m
    return m
t = int(input())
for i in range(t):
    n,a,b,c,d = map(int,input().split())
    dic = {0:0,1:d}
    print(dfs(n))

Measured memory_bytes: 88556
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,n,s) for(int i=s;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  int n;
  cin >> n;
  int firstMax = 0;
  int secnondMax = 0;
  bool wheterTwiceFirstMax = false;
  int stack[n];

  REP(i, n) {
    cin >> stack[i];

    int tmpFirstMax = firstMax;
    firstMax = max(stack[i], firstMax);
    if(tmpFirstMax == stack[i]) {
      wheterTwiceFirstMax = true;
    } else {
      wheterTwiceFirstMax = false;
    }

    if(stack[i] > tmpFirstMax) {
      secnondMax = max(secnondMax, tmpFirstMax);
    } else {
      secnondMax = max(secnondMax, stack[i]);
    }
  }

  REP(i, n) {
    if(wheterTwiceFirstMax || stack[i] != firstMax) {
      cout << firstMax << endl;
    } else {
      cout << secnondMax << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000
#define ll long long
using namespace std;
int main()
{
    int X, ans = 0;
    cin >> X;
    rep(i, 1001) if (100 * i <= X && 105 * i >= X) ans = 1;
    cout << ans << "\n";
}


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

using namespace std;

pair<int, char> d[3333][3333];
int main() {
	string s, t, u;
	cin >> s >> t;
	for (int i = s.length(); i--;) {
		for (int j = t.length(); j--;) {
			if (s[i] == t[j]) d[i][j] = { d[i + 1][j + 1].first + 1,s[i] };
			else d[i][j] = max(d[i + 1][j], d[i][j + 1]);
		}
	}
	for (int i = 0, j = 0; d[i][j].first;) {
		if (s[i] == t[j]) u += d[i++][j++].second;
		else d[i + 1][j] > d[i][j + 1] ? i++ : j++;
	}
	cout << u << endl;
	return 0;
}


Measured memory_bytes: 80128
using System;

namespace ABC072B
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            char[] t = new char[10000000];
            int count = 0;
            for(int i = 0; i < s.Length; i++){
                if(i % 2 == 0){
                    t[count] = s[i];
                    count++;
                }
            }
            for(int i = 0; i < count; i++){
                Console.Write(t[i]);
            }
            Console.WriteLine("");
        }
    }
}


Measured memory_bytes: 13136
class Main
  def self.main lines
    a,b,c = lines[0].split.map(&:to_i)
    [b/a,c].min
  end
end

if $0 == __FILE__
  $stdout = open('/dev/null', 'w')
  r = Main.main STDIN.readlines
  $stdout = STDOUT
  puts r
end

Measured memory_bytes: 3836
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int C = Integer.parseInt(sc.next());
		sc.close();
		if(A == B) {
			if(A == C) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
		}else if(B == C) {
			if(B == A) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
		}else if(C == A) {
			if(C == B) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
		}else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}




int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,t;cin >> a >> b >> t;
	cout << b * (t / a) << endl;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll N[4],K,a[4][1010];
vector<ll> aav;
ll i, j,k,l,ans;
ll mk[3030][1010];
int main(){
    fornum(i,0,3){
        scanf("%lld", &N[i]);
    }
    scanf("%lld", &K);
    fornum(i,0,3){
        fornum(j,0,N[i]){
            scanf("%lld", &a[i][j]);
            //printf("%lld,%lld,%lld\n", i, j, a[i][j]);
        }
    }
    
    fornum(i,0,N[0]){
        fornum(j,0,N[1]){
            aav.push_back(a[0][i] + a[1][j]);
        }
    }
    sort(aav.begin(), aav.end(),greater<ll>());
    
    sort(a[2], a[2] + (N[2]),greater<ll>());
    //printf("%lld,%lld,%lldm", a[0][0], a[1][0], a[2][0]);

    priority_queue<pair<ll, pll>> pq;
    pq.push({aav[0] + a[2][0], {1, 1}});
    fornum(i,0,K){
        auto qa = pq.top();
        auto qb = qa.second;
        pq.pop();
        //printf("%lld,%lld,%lld\n", qa.first, qb.first, qb.second);
        if(mk[qb.first][qb.second]==1){
            i--;
            continue;
        }
        mk[qb.first][qb.second] = 1;
        printf("%lld\n", qa.first);
        if(qb.first<aav.size()){
            pq.push({aav[qb.first]+a[2][qb.second-1], {qb.first + 1, qb.second}});
        }
        if(qb.second<N[2]){
            pq.push({aav[qb.first-1]+a[2][qb.second], {qb.first, qb.second+1}});
        }
    }
    return 0;
}

Measured memory_bytes: 30696
#include<stdio.h>
int bubbleSort(int [],int);
void shutsu(int [],int);

int main(){
  int N,i;
  int A[100];
  int x;

  scanf("%d",&N);
  for(i = 0;i < N;i++){
    scanf("%d",&A[i]);
  }
  x = bubbleSort(A,N);
  shutsu(A,N);
  printf("%d\n",x);
  return 0;
}
  
int bubbleSort(int A[],int N){
  int temp;
  int flag = 1;
  int i = 0,j; 
  while(flag){
    flag = 0;
    for(j = N-1;j >= 1;j--){
      if(A[j] < A[j-1]){
	temp = A[j];
	A[j] = A[j-1];
	A[j-1] = temp;
	flag = 1;
	i++;
      }
    }
  }
  return i;
}

void shutsu(int A[],int N){
  int i;
  for(i = 0;i < N;i++){
    if(i > 0)
      printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}

	



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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cerr <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb() fflush(stdout);

using namespace std;

const int max_n = 1e6+5;
const int mod = 1e9 + 7;

char s[max_n];
char t[max_n];

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

int main() {
	make2(n, m);
	scanf("%s", s);
	scanf("%s", t);
	int d = gcd(n, m);
	int n2 = n/d, m2 = m/d;
	bool ok = true;
	for (int i = 0; i < n; i++) {
		if ((i * 1LL * m2) % n2 == 0) {
			int pos = (i * 1LL * m2) / n2;
			if (s[i] != t[pos]) ok = false;
		}
	}
	if (ok) {
		printf("%lld\n", n2*1LL*m);
	} else {
		printf("-1\n");
	}
}



Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
#include <iomanip>
using namespace std;
// type alias
typedef long long LL;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))

// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');

// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpf(args...) if(TRACE) { fprintf(stderr, ##args); putchar('\n'); }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
template<class Iter> void dumpc(Iter begin, Iter end) { if (TRACE) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; } }

// 22:40 give up

// $ ../batch 756 | diff 756.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address 756.cpp && ./a.out
int N;

vector<LL> primeFactors(LL n) {
  assert(n>=1);
  vector<LL> res;
  for(LL p=2; p*p<=n; ++p) while(n%p==0) {
    res.push_back(p);
    n/=p;
  }
  if(n>1) res.push_back(n);
  return res;
}

int P[101]={};
int dp[100]={};
void solve() {
  for(int i=1; i<=N; ++i) {
    vector<LL> ps=primeFactors(i);
    FORR(p,ps) P[p]++;
  }
  dp[1]=1;
  for(int p=1; p<=100; ++p) if(P[p]>0) {
//    dump2(p,P[p]);
    for(int cnt=75; cnt>=1; --cnt) if(dp[cnt]) {
      for(int f=1; f<=P[p]; ++f) if(cnt*(f+1)<=75) dp[cnt*(f+1)]+=dp[cnt];
    }
  }
  cout<<dp[75]<<endl;
}
void test() {
  int X=16*81*25;
  int i=0;
  for(int p=1; p*p<=X; ++p) if(X%p==0) {
    dump3(++i,p,X/p);
  }
  vector<LL> ps=primeFactors(X);
  dumpAR(ps);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
//  test();
  
  cin>>N;
  solve();
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<random>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define int long long
#define inf 1145141919
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
typedef pair<int, P> PP;
struct edge { int to, cost; };
vector<int>V;
int dp[114510][80];
map<int, int> sb(int a) {
	map<int, int> M;
	for (int i = 2; i*i <= a; i++) {
		while (a%i == 0) {
			a /= i;
			M[i]++;
		}
	}
	if(a!=1)M[a]++;
	return M;
}
void init() {
	rep(i, 80)rep(j, 114510)dp[j][i] = 0;
	return;
}
signed main() {
	int n, m; cin >> n >> m;
	map<int,int>M=sb(m);
	for (auto itr = M.begin(); itr != M.end(); itr++) {
		int a = itr->second;
		//a個の素因数をn個に分ける
		//cout << a << endl;
		init();
		dp[0][0] = 1;
		rep(i, n) {
			rep(j, a+1) {
				rep(k, a+1) {
				if(j>=k)dp[i+1][j] += dp[i][j - k];
				dp[i + 1][j] %= mod;
				}
			}
		}
		V.push_back(dp[n][a]);
	}
	int ans = 1;
	rep(i, V.size()) {
		ans *= V[i];
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 71808
#include <iostream>
#include<string>
#define lli long long int
using namespace std;

int main() {
	// your code goes here
	lli x,k,n,c,las;
	c=0;
	cin>>k>>n;
	if(k>9 || n>9){
		cout<<-1;
	}
	else{
		cout<<k*n;
	}
	// x='Z';
	// las=int('Z');
	// if('Z'-(s[0]+k)>=0)cout<<(char)(s[0]+2);
	// cout<<'Z'<<" "<<(s[0]+k);
	// SUN, MON, TUE, WED, THU, FRI, or SAT, 
	return 0;
}

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

bool solve() {
    string S;
    cin >> S;
    map<char,int> m;
    for ( char c : S ) {
        m[c] = 1;
    }
    if ( m['N'] != m['S'] ) return false;
    if ( m['W'] != m['E'] ) return false;
    return true;
}

int main() {
    string ans = solve() ? "Yes" : "No";
    cout << ans << "\n";
    return 0;
}

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

using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;

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

vector<vector<pii>> edge;
vi color;
int K = 0;
void dfs(int cur_node, int parent_color) {
  K = max(K, (int)edge[cur_node].size());
  int i = parent_color + 1;
  i %= K;
  for (const auto& p : edge[cur_node]) {
    int to = p.first;
    int idx = p.second;

    if (color[idx] == -1) {
      color[idx] = i;
      dfs(to, i);
      ++i;
      i %= K;
    }
  }
}
int main() {
  int N; cin >> N;

  edge.resize(N, vector<pii>());
  color.resize(N-1, -1);
  rep(i, N-1) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    edge[a].emplace_back(b, i);
    edge[b].emplace_back(a, i);
  }
  dfs(0, -1);

  cout << K << endl;
  rep(i, N-1)
    cout << color[i]+1 << endl;

  return 0;
}


Measured memory_bytes: 6912
/*---> 04 May 2020 <--- > 20:15:30 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N=1e5+5;

int32_t main(){__
	int n,k;
	cin>>n>>k;
	int x;
	vi cnt(n+1);
	for(int i=1;i<=k;i++){
		cin>>x;
		int y;
		for(int j=0;j<x;j++){
			cin>>y;
			cnt[y]=1;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(!cnt[i])
			ans++;
	}
	cout<<ans<<"\n";
return 0;
}

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

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

int main(){
    ll H;
    cin >> H;
    ll count = 0;
    ll per_count = 1;
    ll X = H;
    if(X == 1){
        count = 1;
        cout << count << endl;
        return 0;
    }

    while(X / 2 != 0){
        X /= 2;
        per_count++;
    }

    count = pow(2, per_count) - 1;

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
import copy

readline = sys.stdin.buffer.readline


def main():
    N, A = map(int, readline().split())
    X = list(map(int, readline().split()))
    X = [x - A for x in X]

    dp = [0] * 5050
    dp[2525] = 1

    for i in range(N):

        next_dp = copy.copy(dp)
        for t in range(5050):
            if X[i] + t < 5050:
                next_dp[X[i] + t] += dp[t]

        dp = next_dp

    print(dp[2525] - 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
pair<ll, ll> A[2000];
ll dp[2005][2005];
int main() {
    init();
    ll N;
    cin >> N;
    rep(i, N){
        cin >> A[i].first;
        A[i].second = i;
    }
    sort(A, A + N, greater<pair<ll,ll>>());
    rep(i, N){
        rep(l,i+1){
            int r = i - l;
            chmax(dp[l + 1][r], dp[l][r] + A[i].first * abs(A[i].second - l));
            chmax(dp[l][r + 1], dp[l][r] + A[i].first * abs(N - r - A[i].second - 1));
        }
    }

    ll ans = -INF;
    rep(i, N + 1) chmax(ans, dp[i][N - i]);
    cout << ans << endl;
    
    
}

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

int n;
ll val[1 << 17];
ll ans[1 << 17];
int a[20][20];
ll find(int mask) {
  if (ans[mask] == -1e18) {
    for (int submask = mask; submask > 0; submask = (submask - 1) & mask) {
      ans[mask] = max(ans[mask], val[submask] + find(mask & ~submask));
    }
  }
  return ans[mask];
}

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

  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    val[mask] = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < i; j++) {
        if ((mask & (1 << i)) && (mask & (1 << j))) {
          val[mask] += a[i][j];
        }
      }
    }
    ans[mask] = -1e18;
  }
  ans[0] = 0;
  cout << find((1 << n) - 1) << '\n';
  return 0;
}

Measured memory_bytes: 1280
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

int main()
{	
	int a, b;
	cin >> a >> b;

	int answer = -1;
	if (a <= 9 & b <= 9) answer = a * b;

	cout << answer;

	return 0;
}

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

int div2(int n) {
    int cnt = 0;
    while (n > 0) {
        if (n % 2 == 0) {
            cnt++;
            n /= 2;
        }
        else {
            break;
        }
    }
    return cnt;
}

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

    int maximum = 0, ans = 0;
    for (int i = 1; i <= N; i++) {
        if (maximum < div2(i) || i == 1) {
            ans = i;
            maximum = div2(i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <unordered_map>

int main() {
  int N;
  std::cin >> N;
  int a[100001];
  std::unordered_map<int, int> m{};
  for (int i = 1; i <= N; ++i)
    std::cin >> a[i];

  int i = 1;
  while (true) {
    int n = a[i];
    ++m[n];
    if (n == 2)
      break;
    if (m[n] > 1) {
      std::cout << -1 << std::endl;
      return 0;
    }
    i = n;
  }
  std::cout << m.size() << std::endl;
}


Measured memory_bytes: 4772
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
 
int main(){
 int A ,B ;
 cin  >> A >> B ;
 if ( A+B >= A-B && A+B >= A*B ) cout << A+B << endl ;
 if ( A+B < A-B && A-B > A*B ) cout << A-B << endl ;
 if ( A*B > A-B && A+B < A*B ) cout << A*B << endl ;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

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

int main(void) {
  long long a, b;
  cin >> a >> b;
  ll g = gcd(a, b);
  int ans = 1;
  if(g % 2 == 0) {
    ans++;
    while(!(g % 2))
      g /= 2;
  }
  for(ll i = 3; i * i <= g; i += 2) {
    if(g % i == 0) {
      ans++;
      while(g % i == 0)
        g /= i;
    }
  }
  if(g != 1)
    ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <istream>
#include <set>
#include <queue>
#define rep0(i,n) for (long long int i = 0; i <= (n); ++i)
#define rep1(i,n) for (long long int i = 1; i <= (n); ++i)
#define REP(a,b) for (long long int i = a; i <= (b); ++i) 
#define ps push_back 
using namespace std;
typedef long long ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
int a;
  cin>>a;
  if(a < 1200)
    cout<<"ABC"<<endl;
  else 
    cout<<"ARC"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;
 
vector<int> len;
vector<map<int, int> > value;
 
int dfs(string& s, int& k)
{
    if(isdigit(s[k])){
        int ret = 0;
        while(k < s.size() && isdigit(s[k])){
            ret *= 10;
            ret += s[k] - '0';
            ++ k;
        }
        return ret;
    }
 
    char c = s[k];
    k += 2;
    int a = dfs(s, k);
    ++ k;
 
    if(k < s.size() && s[k] == '='){
        ++ k;
        if(a == -1 || a >= len[c])
            return -1;
        else
            return value[c][a] = dfs(s, k);
    }else{
        if(a == -1 || value[c].find(a) == value[c].end())
            return -1;
        else
            return value[c][a];
    }
}
 
int substitute (string& s)
{
    char c=s[0];
    int k=2;
    int a=dfs(s,k);
    if(a==-1 || len[c]<=a) return -1;
  
    k += 2;
    int res=dfs(s,k);
    if(res == -1)
        return -1;
    return value[c][a]=res;
}
 
int solve(vector<string>& s)
{
    len.assign(128, 0);
    value.assign(128, map<int, int>());
 
    int n = s.size();
    for(int i=0; i<n; ++i){
        if(s[i].find('=') == string::npos){
            int k = 2;
            len[s[i][0]] = dfs(s[i], k);
        }else{
            int k = 0;
            if(substitute(s[i]) == -1)
                return i + 1;
        }
    }
 
    return 0;
}
 
int main()
{
    for(;;){
        vector<string> s;
        for(;;){
            string t;
            cin >> t;
            if(t == ".")
                break;
            s.push_back(t);
        }
 
        if(s.empty())
            return 0;
 
        cout << solve(s) << endl;
    }
}

Measured memory_bytes: 1340
@cnt = 0
def merge(arr,left,mid,right)
    n1 = mid-left
    n2 = right-mid
    l = []
    r = []
    i = 0
    while i < n1
         l[i] =arr[left+i]
         i +=1
    end
    i = 0
    while i < n2
        r[i] = arr[mid+i]
        i +=1
    end
    l[n1] = 9999999999
    r[n2] = 9999999999
    i = 0
    j = 0
    k = left
    while k < right
        if l[i] <= r[j]
            arr[k] = l[i]
            i +=1
        else
            arr[k] = r[j]
            j +=1
        end
        k +=1
        @cnt += 1
    end
end

def mergesort(arr,left,right)
    #leftは配列の先頭だから常に0。関数の中で関数を呼び出すからひたすら配列の要素が一つだけになるまでマージソートを繰り返す
    #要素の分解が１まできたことを表す。
    if left+1 < right
        mid =(left+right)/2
        #配列の左半分
        mergesort(arr,left,mid)
        #配列の右半分
        mergesort(arr,mid,right)
        merge(arr,left,mid,right)
    end
    return arr
end

n = gets.to_i
arr = gets.split(" ").map(&:to_i)
left = 0
right = arr.count
i = 0

x = mergesort(arr,left,right)
puts x.join(" ")
p @cnt


Measured memory_bytes: 72400
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read_option<T: FromStr>() -> Option<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()
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let n = read::<f32>();
    let ans = if n % 2.0 == 0.0 {
        1.0 / 2.0
    } else {
        ((n + 1.0) / 2.0) / n
    };
    println!("{}", ans);
}


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

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素


template<typename T> class LazyRMQ {
    public:
    int n;
    T inf = INF;
    vector<T> data, lazy;
    
    LazyRMQ(int m, T init_value=-INF){
        // 2のべき乗にする
        n = 1;
        while(n < m) n <<= 1;
        data.assign(2*n-1, init_value);
        lazy.assign(2*n-1, 0);
        inf = init_value;
    }

    void eval(int k, int kl, int kr){
        if(data[k] == inf) data[k] = 0;
        if(lazy[k] == 0) return;
        data[k] += lazy[k];
        if(kr - kl > 1){
            lazy[2*k+1] += lazy[k];
            lazy[2*k+2] += lazy[k];
        }
        lazy[k] = 0;
    }

    // [s,t)
    void add(int s, int t, T x, int k, int kl, int kr){
        eval(k, kl, kr);
        if(kr <= s || t <= kl) return;
        if(s <= kl && kr <= t){
            lazy[k] += x;
            eval(k, kl, kr);
            return;
        }
        int kc = (kl+kr)/2;
        add(s, t, x, 2*k+1, kl, kc);
        add(s, t, x, 2*k+2, kc, kr);
        data[k] = max(data[2*k+1], data[2*k+2]);
    }

    void add(int s, int t, T x) {
        add(s, t, x, 0, 0, n);
    }

    // [s,t)
    T find(int s, int t, int k, int kl, int kr){
        eval(k, kl, kr);
        if(kr <= s || t <= kl) return inf;
        if(s <= kl && kr <= t) return data[k];
        int kc = (kl+kr)/2;
        T vl = find(s, t, 2*k+1, kl, kc);
        T vr = find(s, t, 2*k+2, kc, kr);
        return max(vl, vr);
    }

    T find(int s, int t) {
        return find(s, t, 0, 0, n);
    }
};

int main() {
    int n,m,l,r; ll a;
    cin >> n >> m;
    vector<pair<int, ll>> ranges[n+1];
    for(int i=0;i<m;++i) {
        cin >> l >> r >> a;
        ranges[r].emplace_back(l, a);
    }

    LazyRMQ<ll> tree(n+2, -(1<<30));
    for(int i=1;i<=n;++i) {
        ll opt = tree.find(0, i);
        tree.add(i, i+1, opt);
        for(pair<int, ll> p: ranges[i]) {
            tree.add(p.first, i+1, p.second);
        }
    }

    cout << tree.find(0, n+1) << endl;
}

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

int B[ 30 ];

int main()
{
int i;
int j;
int N;
int M;
int C;
int A;
int iSum;
int iCnt;

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

	cin >> N;
	cin >> M;
	cin >> C;

	for( i = 0; i < M; i++ ) cin >> B[ i ];

	iCnt = 0;
	for( i = 0; i < N; i++ )
	{
		iSum = C;
		for( j = 0; j < M; j++ )
		{
			cin >> A;

			iSum += A * B[ j ];
		}

		if( iSum > 0 ) iCnt++;
	}

	cout << iCnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,h[100005];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d",&h[i]);
		if(h[i]>h[i-1]&&h[i]>=0)h[i]--;
			else if(h[i]<h[i-1]){puts("No");return 0;}
	}
	puts("Yes");
	return 0;
} 


Measured memory_bytes: 640
import copy
def ls_to_int (ls):
	ls_int = []
	for i in ls:
		ls_int.append(int(i))
	return ls_int

def judge(ls):
	is_sorted = True
	for i in range(len(ls)):
		for j in range(i, len(ls)):
			if ls[i] > ls[j] :
				is_sorted = False
				break
	return is_sorted

N = int(input())
p = input().split()
p = ls_to_int(p)
memory = copy.deepcopy(p)
is_able = False
for i in range(len(p)):
	for j in range(len(p)):
		temp = p[i]
		p[i] = p[j]
		p[j] = temp
		if judge(p):
			is_able = True
			break
		p = copy.deepcopy(memory)
	if is_able:
		break
if is_able:
	print("YES")
else:
	print("NO")

Measured memory_bytes: 3572