akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define ll long long
#define ull unsigned long long
#define dd double
#define oo 1001007000
#define ff float
#define ooo 4223352036854775007
#define iii pair<ll,ll>
#define vii vector<ll>
#define viii vector<iii>
#define sss pair<str,str>
#define str string
#define sii set<ll>
#define siii set<iii>
#define r0 return 0
#define pb push_back
#define sz size
using namespace std;

const char E='\n';
const int N=200005;
const int NN=2005;
const ll md=998244353;



int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    ll a[N]={0};
    for (int i=1;i<=n;i++){
        cin >> a[i];
    }
    sort(a+1,a+n+1);
    reverse(a+1,a+n+1);
    ll ans=a[1];
    int k=n-2;
    for (int i=2;i<=n;i++){
        if (k==0)break;
        if (k>0){ans+=a[i];k--;}
        if (k>0){ans+=a[i];k--;}

    }
    cout << ans << E;
    return 0;
}


/*







*/


Measured memory_bytes: 5252
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

a,b,c,d = LI()

# if 0<a and 0<c:
#     print(b*d)
# elif 0<a and d<0:
#     print(a*d)
# elif 0<c and b<0:
#     print(b*c)
# elif 0<b and 0<d:
#     print(b*d)
# elif b<0 and 0<d:
#     print(b*d)
# elif d<0 and 0<b:
#     print(b*d)
# elif b<0 and d<0:
#     print(a*c)
# elif b==0 and d==0:
#     print(a*c)
# elif a==0 and c==0:
#     print(b*d)
# elif c==0:
#     print(b*d)
# elif a==0:
#     print(b*d)

if a==b==c==d==0:
    print(0)
elif 0<=a and 0<=c:
    print(b*d)
elif b<=0 and d<=0:
    print(a*c)
elif a<0<b:
    if 0<=c:
        print(b*d)
    elif c<0<d:
        print(max(a*c,b*d))
    elif d<=0:
        print(a*c)
elif c<0<d:
    if 0<=a:
        print(b*d)
    elif a<0<b:
        print(max(a*c,b*d))
    elif b<=0:
        print(a*c)
elif 0<=a and d<=0:
    print(a*d)
elif 0<=c and b<=0:
    print(b*c)


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

#define CO const
#define IN inline
typedef long long int64;

template<class T> IN T read(){
	T x=0,w=1;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-') w=-w;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*w;
}
template<class T> IN T read(T&x){
	return x=read<T>();
}

CO int N=200;
char grid[N][N];
int sum[N][N],dp[2][N][N][N];

IN int query(int i,int l,int j,int r){
	return sum[j][r]-sum[i-1][r]-sum[j][l-1]+sum[i-1][l-1];
}
IN bool equal(int i,int l,int j,int r){
	int s=query(i,l,j,r);
	return s==0 or s==(j-i+1)*(r-l+1);
}
int find(int ans,int i,int j,int l){
	int L=i,R=j-1,res=-1;
	while(L<=R){
		int mid=(L+R)>>1;
		int u=dp[ans&1][i][mid][l];
		int v=dp[ans&1][mid+1][j][l];
		res=max(res,min(u,v));
		if(u<v) R=mid-1;
		else L=mid+1;
	}
	return res;
}
int main(){
	int n=read<int>(),m=read<int>();
	for(int i=1;i<=n;++i){
		scanf("%s",grid[i]+1);
		for(int j=1;j<=m;++j) sum[i][j]=grid[i][j]=='#';
	}
	for(int i=1;i<=n;++i)for(int j=1;j<=m;++j)
		sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
	for(int i=1;i<=n;++i)for(int j=i;j<=n;++j)
		for(int l=1,r;l<=m;l=r+1){
			for(r=l-1;r<m and equal(i,l,j,r+1);++r);
			for(int p=l;p<=r;++p) dp[0][i][j][p]=r;
			if(r==l-1) dp[0][i][j][l]=r,++r;
		}
	int ans=0;
	for(ans=1;dp[(ans-1)&1][1][n][1]<m;++ans)
		for(int i=1;i<=n;++i)for(int j=i;j<=n;++j)
			for(int l=1;l<=m;++l){
				int v=dp[(ans-1)&1][i][j][l];
				if(v==m) {dp[ans&1][i][j][l]=m; continue;}
				dp[ans&1][i][j][l]=max(dp[(ans-1)&1][i][j][v+1],find(ans-1,i,j,l));
			}
	printf("%d\n",--ans);
	return 0;
}


Measured memory_bytes: 61568
import math

def main():
    a, b, ang_ab = [float(x) for x in input().split()]

    rad_ab = (ang_ab/180)*math.pi
    c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(rad_ab))

    h = b*math.sin(rad_ab)
    s = (a*h)/2
    l = a+b+c

    print("{:f} {:f} {:f}".format(s, l, h))

if __name__ == '__main__':
    main()



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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    ull N, x;
    cin >> N >> x;
    vector<ull> X(N);
    vector<ull> accX(N + 1);
    for (int i = 0; i < N; i++) {
        cin >> X[i];
        accX[i + 1] = accX[i] + X[i];
    }

    ull ans = numeric_limits<ull>::max();
    for(int k = 1; k <= N; k++) {
        int w = k * 2;
        ull cnt = 0;
        ull sum = 0;
        bool f = false;
        for(int t = N; ; t -= w) {
            if (f) w = k;
            ull cost = 5 + 2 * cnt;
            sum += cost * (accX[t] - accX[max(0, t - w)]);
            if (t - w <= 0) break;
            cnt++;
            f = true;
        }
        ans = min(ans, k * x + sum);
    }
    cout << ans + N * x << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

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

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s1, s2; cin >> s1 >> s2;
	vector<vector<int>>dp(s1.size() + 1, vector<int>(s2.size() + 1));
	rep(i, 0, s1.size() + 1)dp[i][0] = i;
	rep(i, 0, s2.size() + 1)dp[0][i] = i;
	rep(i, 1, s1.size() + 1)rep(j, 1, s2.size() + 1)
		dp[i][j] = min(dp[i - 1][j] + 1, min(dp[i][j - 1] + 1, dp[i - 1][j - 1] + (s1[i - 1] != s2[j - 1])));
	cout << dp[s1.size()][s2.size()] << endl;
	return 0;
}

Measured memory_bytes: 6732
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;

using namespace std;
map<int, int> a;
int main(){
int n, x, ans = 0;
scanf("%d", &n);
for(int i = 0; i < n; i++){
    cin >> x;
    if(a[x] == 1){
        ans--;
        a[x]--;
    }
    else{
        a[x]++;
        ans++;
    }
}
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            var W = new int[10];
            for (var i = 0; i < 10; i++)
                W[i] = int.Parse(Console.ReadLine());
            var K = new int[10];
            for (var i = 0; i < 10; i++)
                K[i] = int.Parse(Console.ReadLine());
            Console.WriteLine("{0} {1}",
                W.OrderByDescending(k => k).Take(3).Sum(),
                K.OrderByDescending(k => k).Take(3).Sum());
        }
    }
}

Measured memory_bytes: 6364
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define INF 1LL<<60

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int N, T;
    cin >> N >> T;
    vector<int> A(N), B(N);
    vector<pair<int, int>> foods(N);
    REP(i, N){
        cin >> A[i] >> B[i];
        foods[i] = make_pair(A[i], B[i]);
    }

    sort(foods.rbegin(), foods.rend());
    // dp[t][i]: i番目までのメニューを時刻tまでに注文する場合の最大値
    vector<vector<int>> dp(T+1, vector<int>(N, 0)); 

    REP(i, N) {
        if(i>0)
            dp[T-1][i] = max(dp[T-1][i-1], foods[i].second);
        else
            dp[T-1][i] = foods[i].second;
    }

    FORR(t, T-1, 0) {
        REP(i, N) {
            if(t-foods[i].first>=0) {
                dp[t-foods[i].first][i] = max(dp[t][i-1] + foods[i].second, dp[t-foods[i].first][i]);
            }
            dp[t][i] = max(max(dp[t+1][i], dp[t][i-1]), dp[t][i]);
        }
    }

    // FOR(t, 0, T) {
    //     REP(i, N) cerr << dp[t][i] << " ";
    //     cerr << endl;
    // }

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

Measured memory_bytes: 35712
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 
#define PI 3.141592653589793238

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;
typedef gp_hash_table<long int,long int> HashTable;

int main(){
   IOS;
 /*    #ifndef ONLINE_JUDGE
         freopen("in.txt",  "r",  stdin);
         freopen("out.txt", "w", stdout);
     #endif */
   
   long int n;
   cin>>n;

   cout<<(n + n*n + n*n*n);
   return 0;
}

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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}

int src[100001], tgt[100001];

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;

    cin >> n;

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

    long long inc = 0;

    for(int i = n - 1; i >= 0; --i){
        long long a = src[i];
        long long b = tgt[i];

        inc += (b - ((a + inc) % b)) % b;

    }

    cout << inc;


    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h> 
using namespace std; 
int gcdEx(int a, int b, int *x, int *y){if(!a){*x=0;*y=1;return b;} 
int x1,y1,gcd=gcdEx(b%a,a,&x1,&y1); *x=y1-(b/a)*x1;*y=x1; return gcd;}
int modI(int b, int m)      {int x,y;gcdEx(b,m,&x,&y);return (x%m+m)%m;}
typedef long long           ll;
typedef pair<int, int>      pii;
typedef vector<int>         vi;
typedef vector<pii>         vii;
typedef set<int>            si;
typedef map<string, int>    msi;
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define loop(i,b,n)           for(int i=b;i<n;i++)
#define loopv(i,b,n,a)         for(int i=b;i<n;i+=a)
#define loopr(i,b,n)           for(int i=n;i>=0;i--)

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "\n\n" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define mp                  make_pair
#define ff                  first
#define ss                  second
#define pb                  push_back 
#define MOD                 1000000007 
#define modA(a,b)           (((a%MOD)+(b%MOD))%MOD)
#define modS(a,b)           (((((a%MOD)-(b%MOD))%MOD)<0)?(int)(MOD+((a%MOD)-(b%MOD))%MOD):(int)(((a%MOD)-(b%MOD))%MOD))
#define modM(a,b)           (int)((((ll)(a%MOD))*((ll)(b%MOD)))%MOD)
#define modD(a,b)           ((modI(b,MOD)*(a%MOD))%MOD)
ll modP(ll x, ll y)         {ll r=1; x%=MOD; while(y>0){if(y&1){r=(r*x)%MOD;}
y=y>>1; x=(x*x)%MOD;} return r;}

int main()
{ 
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);
  //  start_routine();
    
   ll t,sum=0,ans=0,n;
  // cin>>t;

   //while(t--) {  cin>>n ; }
   cin>>n>>t;
   if((n+t)&1)
   cout<<"IMPOSSIBLE" ;
   else
   cout<<(n+t)/2;
    
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
template <class T>
T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T>
T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T>
T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}
template <class T>
bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MAX_A = 1e5;
    int N;
    vector<int> cnt(MAX_A + 1, 0);
    cin >> N;
    REP(i, N) {
        int a;
        cin >> a;
        cnt[a]++;
    }
    int res = 0;
    REP(i, MAX_A - 1) {
        amax(res, cnt[i] + cnt[i + 1] + cnt[i + 2]);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
//#define MOD 10000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
	map<int, int>ans;
	int now = 2;
	while (now * now <= x) {
		if (x % now == 0) {
			x /= now;
			ans[now]++;
		}
		else now++;
	}
	if (x != 1) ans[x]++;
	return ans;
}
int MY_COM(int n, int k) {
	k = min(k, n - k);
	int x = 1, y = 1;
	rep(i, k) {
		y *= i + 1;
		y %= MOD;
	}
	for (int i = n - k + 1; i <= n; i++) {
		x *= i;
		x %= MOD;
	}
	return x * modinv(y, MOD) % MOD;
}

long long combi[1005][1005];

void COMTABLEinit(int n) {
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= i; j++) {
			if (j == 0 || j == i) combi[i][j] = 1;
			else combi[i][j] = combi[i - 1][j - 1] + combi[i - 1][j];
		}
	}
}

long long COM_byTABLE(int n, int k) {
	return combi[n][k];
}


signed main() {
	int n, a, b;
	cin >> n >> a >> b;
	int ans = mod_pow(2, n, MOD) - 1;
	ans -= MY_COM(n, a) + MY_COM(n, b);
	while (ans < 0) ans += MOD;
	cout << ans << endl;

	return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;

const int N = 5e5 + 1;
const int LOG = 61;
const int INF = 1e9;
const int MOD = 998244353;
const int D = 700;
const ll LLMOD = 1e9 + 7;
const ll LLINF = 1e18;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int ans = 0;
    int m, d;
    cin >> m >> d;
    forab(i, 1, m + 1) {
        forab(j, 1, d + 1) {
            if (j % 10 >= 2 && j / 10 >= 2 && (j / 10) * (j % 10) == i) {
                ans++;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
import numpy as np
class InvCom:
    def __init__(self, space, mod):
        self.mod = mod
        self.fac = list(np.zeros(space).astype(np.int64))
        self.finv = list(np.zeros(space).astype(np.int64))
        self.inv = list(np.zeros(space).astype(np.int64))
        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1
        for i in range(2, space):
            self.fac[i] = self.fac[i - 1] * i % self.mod
            self.inv[i] = self.mod - self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.finv[i] = self.finv[i - 1] * self.inv[i] % self.mod

    def __call__(self,n,r):
        if n < r:
            return 0
        if n < 0 or r < 0:
            return 0
        return self.fac[n] * (self.finv[r] * self.finv[n - r] % self.mod) % self.mod

x, y = map(int,input().split(' '))
if (x + y) % 3 != 0:
    print(0)
else:
    m = (2 * x -y) // 3
    n = (y - m) // 2
    if n < 0 or m < 0:
        print(0)
    else:
        fact = InvCom(n + m + 1,1000000007)
        print(fact(n + m,n))

Measured memory_bytes: 159336
#include<bits/stdc++.h>
#define endl  "\n"
#define ll long long
#define PI acos(-1.0)
#define test cout<<"\n****\n"
#define precise fixed(cout);cout<<setprecision(12)
#define fast  ios_base :: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using  namespace  std;


int main(){

    fast;

    string str;
    cin>>str;

    string res = "";

    for(int i=0;i<str.size();i++){
        res = res + 'x';
    }

    cout<<res;

    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
int main(){
  int n; cin>>n;
  vector<P> num(n);
  for(int i=0;i<n;i++){
    ll x,y; cin>>x>>y;
    num[i]=P(x,y);
  }
  ll ans=0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      ll same=0;
      ll dx=num[j].first-num[i].first,dy=num[j].second-num[i].second;
      for(int k=0;k<n;k++){
        ll a=num[k].first+dx,b=num[k].second+dy;
        for(int l=0;l<n;l++){
          if(a==num[l].first && b==num[l].second) same++;
        }
      }
      ans=max(same,ans);
    }
  }
  cout<<n-ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;


int main(){
	int n;
	cin >> n;
	vi a(n), b;
	rep(i, n) cin >> a[i];
	rep(i, n) {
		if(b.empty()||b.back()!=a[i]) b.pb(a[i]);
	}
	if(n == 1 || b.size() ==1) {
		cout << 1 << endl;
		return 0;
	}
	
	int ans = 0;
	int f = -1;
	REP(i, 1, b.size()) {
		if(f==-1) {
			f = (b[i-1] < b[i]?1:0);
		}
		else if(f == 1) {
			if(b[i-1] < b[i]);
			else ans++, f = -1;
		}
		else {
			if(b[i-1] > b[i]);
			else ans++, f = -1;
		}
	}
	cout << ans+1 << endl;
}	


Measured memory_bytes: 1276
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect


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


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    N = I()
    A = LI()
    Q = I()
    BC = [LI() for _ in range(Q)]

    d = defaultdict(int)

    for ai in A:
        d[ai] += 1

    ans = 0
    for (k, v) in d.items():
        ans += k * v

    for (b, c) in BC:
        tmp = d[b]
        d[b] = 0
        ans -= tmp * b
        d[c] += tmp
        ans += tmp * c
        print(ans)


main()


Measured memory_bytes: 38736
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define vi vector <int>
#define endl "\n"
#define f(n) for(int i=0;i<n;i++)
#define vvi vector <vector<int> >
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>=b;i--)
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define gcd __gcd
#define init(i,k) memset(i,k,sizeof i)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define setBits(x) __builtin_popcountll(x)
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define N 100005
#define mod 1000000007
double dp[301][301][301];
double fun(int x,int y,int z,int n)
{
	if(x<0 || y<0 || z<0)
	{
		return 0;
	}
	if(x==0 && y==0 && z==0)
	{
		return 0;
	}
	if(dp[x][y][z]>-0.9)
	{
		return dp[x][y][z];
	}
	double lol=x*1.0*fun(x-1,y,z,n)+y*1.0*fun(x+1,y-1,z,n)+z*1.0*fun(x,y+1,z-1,n)+n;
	lol=lol/((x+y+z)*1.0);
	dp[x][y][z]=lol;
	return lol;
}
void solve()
{
	int n;
	cin>>n;
	vi v(n);
	f(n)
		cin>>v[i];
	int x=0,y=0,z=0;
	f(n)
	{
		if(v[i]==1)
		{
			x++;
		}
		if(v[i]==2)
		{
			y++;
		}
		if(v[i]==3)
		{
			z++;
		}
	}
	cout<<fixed<<setprecision(10)<<fun(x,y,z,n)<<endl;;
}
signed main()
{
    int t=1;
    //cin>>t;
    for(int i=0;i<301;i++)
    {
    	for(int j=0;j<301;j++)
    	{
    		for(int k=0;k<301;k++)
    		{
    			dp[i][j][k]=-1.0;
    		}
    	}
    }
    for(int i=1;i<=t;i++)
    {
    	//cout<<"Case #"<<i<<": ";
    	solve();
    	//cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 216844
S = input()
s2 = int(S[0:2])
s4 = int(S[2:4])
if s2 <= 12 and s2 > 0:
    if s4 <=12 and s4 > 0:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if s4 <= 12 and s4 > 0:
        print('YYMM')
    else:
        print('NA')

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

int main() {
	int N, M, X;
	int A[110];
	int counter = 0;
	cin >> N >> M >> X;
	for (int i = 0; i < M; ++i) cin >> A[i];
	
	for (int i = 0; i < M; ++i) {
		if (A[i] < X) ++counter;
	}
	if (counter > M - counter) counter = M - counter;
	cout << counter << endl;
}

Measured memory_bytes: 256
"use strict";

const main = arg => {
  const input = arg.trim().split("\n");
  const N = parseInt(input[0]);
  const S1 = input[1].split(" ")[0];
  const S2 = input[1].split(" ")[1];
  let s = "";
  for (let i = 0; i < N; i ++ ) {
    s  = s + S1.substring(i, i + 1);
    s  = s + S2.substring(i, i + 1);
  }
  console.log(s);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29648
#include <iostream>
#include <cmath>
#include <algorithm>
#include <math.h>
using namespace std;
using ll = long long;
using R = double;



int main(void){
 char a,b;
 cin >> a >>b;
 if(a == 'H'){
    cout << b <<endl;
 }
 else{
 	if(b == 'H') cout << 'D' <<endl;
 	else cout << 'H' << endl;
 }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  string s;
  cin >> s;
  string h="2019/04/30";
  if(h>=s)cout << "Heisei" << endl;
  else cout << "TBD" << endl;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s;
		int total = 0;
		
		while (sc.hasNext()) {
			s = sc.next();
			String[] nums = s.split("[^0-9]+");
			
			for (int i=0; i<nums.length; i++) {
				if (nums[i].isEmpty()) {continue;}
				total += Integer.parseInt(nums[i]);
			}
		}
		
		out.println(total);
	}
}


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

const int mxN = 17;
int N, a[mxN][mxN];
ll dp[1 << mxN], scores[1 << mxN];
vector<int> rem;

void rec(int idx, int mask, ll score, int grp) {
	if (idx == (int) rem.size()) {
		dp[mask] = max(dp[mask], score + scores[grp]);
		return;
	}
	rec(idx + 1, mask, score, grp);
	rec(idx + 1, mask ^ (1 << rem[idx]), score, grp ^ (1 << rem[idx]));
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	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++) {
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				if ((mask & (1 << i)) && (mask & (1 << j))) {
					scores[mask] += a[i][j];
				}
			}
		}
	}
	for (int mask = 0; mask < (1 << N); mask++) {
		rem.clear();
		for (int i = 0; i < N; i++) {
			if (!(mask & (1 << i))) {
				rem.push_back(i);
			}
		}
		rec(0, mask, dp[mask], 0);
	}
	cout << dp[(1 << N) - 1];
	
	return 0;
}


Measured memory_bytes: 4672
#include<iostream>
using namespace std;
int main(){
  int N;
  cin>>N;
  int a=N/100;
  int b=(N%100)/10;
  int c=N%10;
  if(a==7||b==7||c==7){
  cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;}
    }
  


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

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

#define ll long long
#define vl vector<ll>
#define vll vector<vl>
#define P pair<int, int>

const int INF = 1e9;

int main() {
	int n;
	int a[1001010];
	cin >> n;
	char c;
	rep(i, n)
	{
		cin >> c;
		a[i]=(int)c-(int)'1';
	}
	bool maji=true;
	rep(i, n) if(a[i]==1) maji=false;
	if(maji) rep(i, n) a[i]/=2;
  	//rep(i, n) cout << a[i];
	int ord[1001010];
  	ord[0]=0;
	for(int i=1; i<=n-1; i++)
	{
		int tmp=0;
		int tmpp=i;
		while(tmpp%2==0)
		{
			tmp++;
			tmpp/=2;
		}
		ord[i]=tmp;
	}
  	//rep(i, n) cout << ord[i];
  	//cout << endl;
	int cb[1001010];
	ll rui[1001010];
	rui[0]=0;
	rep(i, n-1) rui[i+1]=rui[i]+ord[i+1];
	rep(i, n)
	{
		if(i==0 || i==n-1) cb[i]=1;
		else
		{
			if(rui[i]<rui[n-1]-rui[n-1-i]) cb[i]=0;
			else cb[i]=1;
		}
	}

	int ans=0;
	rep(i, n) ans=(ans+cb[i]*a[i])%2;
	if(maji) ans*=2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 19840
A = []
for i in range(3):
    A = A + [int(i) for i in input().split()]
N = int(input())
for i in range(N):
    b = int(input())
    if b in A:
        j = A.index(b)
        A[j] = -1
if (A[0] == -1 and A[3] == -1 and A[6] == -1) \
    or (A[1] == -1 and A[4] == -1 and A[7] == -1) \
    or (A[2] == -1 and A[5] == -1 and A[8] == -1) \
    or (A[0] == -1 and A[1] == -1 and A[2] == -1) \
    or (A[3] == -1 and A[4] == -1 and A[5] == -1) \
    or (A[6] == -1 and A[7] == -1 and A[8] == -1) \
    or (A[0] == -1 and A[4] == -1 and A[8] == -1) \
    or (A[2] == -1 and A[4] == -1 and A[6] == -1):
    print('Yes')
else:
    print('No')



Measured memory_bytes: 3064
#include <iostream>
#include <set>
using namespace std;
int main(){
    int n;
    cin >> n;
    long long a;
    long long b[n+1];
    for(int i = 0;i<n;i++){
        cin >> a;
        b[a]=i+1;
    }
    set<int> st;
    st.insert(0);
    st.insert(n+1);
    long long ans = 0;
    long long l,r;
    for(int i = 1;i<=n;i++){
        auto itr = st.upper_bound(b[i]);
        r = *itr;
        itr--;
        l = *itr;
        ans+=i*(b[i]-l)*(r-b[i]);
        st.insert(b[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << a[1] - a[0] + a[2] - a[1] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
using namespace std;
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
int main(){
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(N*A, B) << endl;
    return 0;
}

Measured memory_bytes: 256
tax :: Int -> Int -> Int -> Bool
tax a b v = x == a && y == b
    where x = v * 8 `div` 100
          y = v * 10 `div` 100

solve :: Int -> Int -> Int
solve a b =
    let xs = [x | x <- [1..1000], tax a b x]
    in if null xs then -1 else head xs


main :: IO ()
main = do
    [a, b] <- map read . words <$> getLine
    print $ solve a b

Measured memory_bytes: 508
#include<cstdio> 
#include<algorithm>
using namespace std;
const int MAX_N = 100;
int N, K; int X[MAX_N];
int main(){ 
  scanf("%d", &N); 
  scanf("%d", &K); 
  for(int i = 0; i < N; ++i){ 
    scanf("%d", X + i); 
  } 
  int ans = 0; 
  for(int i = 0; i < N; ++i){ 
  int tmp = min(X[i], K - X[i]); 
    ans += tmp; 
  } 
  printf("%d\n", ans * 2); 
  return 0; 
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

const int mx = 1000005;

int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) {
        cin >> a[i];
    }
    sort(ALL(a));
    vector<int> res(mx, 0);
    for(auto e : a){
        if(res[e]) {
            res[e] = 2;
            continue;
        }
        for(ll i = e; i < mx; i += e){
            res[i]++;
        }
    }
    int cnt = 0;
    for(auto e : a){
        if(res[e] == 1) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 7964
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }

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

    double ave = 0;
    for(int i = 0; i < n; i++){
        ave += a[i];
    }
    ave /= n;

    ll ans_min = 0;
    for(int i = 1; i < n; i++){
        if(abs(a[i] - ave) < abs(a[ans_min] - ave)){
            ans_min = i;
        }
    }
    cout << ans_min << endl;
    return 0;
}


Measured memory_bytes: 256
import sys


def partition(A, p, r):
    x = A[r]
    i = p-1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i+1], A[r] = A[r], A[i+1]
    return i+1, A



if __name__ == "__main__":
    lines = sys.stdin.readlines()
    N = int(lines[0])
    nums = map(int, lines[1].split(" "))
    (i, A) = partition(nums, 0, N-1)
    A = map(str, A)
    A[i] = "[{0}]".format(A[i])
    print " ".join(A)

Measured memory_bytes: 18292
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

C = sInLV(2)

b1 = C[0][0] == C[1][2]
b2 = C[0][1] == C[1][1]
b3 = C[0][2] == C[1][0]

ans = 'YES' if b1 and b2 and b3 else 'NO'

print(ans)

Measured memory_bytes: 61872
from collections import Counter
mod=998244353
n=int(input())
D=list(map(int,input().split()))
Count=Counter(D)
if D[0]!=0 or Count[0]!=1:print(0);exit()
ans=1
for i in range(1,max(Count)+1):
    ans *=Count[i-1]**Count[i]
    ans %=mod
print(ans)

Measured memory_bytes: 19936
import math
K = int(input())
A = [int(i) for i in input().split()][::-1]

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

ans_low = 2
ans_high = 3

for i in range(1, K):
    next_ans_high = ((ans_high//A[i])+1)*A[i]-1
    next_ans_low = math.ceil(ans_low/A[i])*A[i]

    if (next_ans_high // A[i])*A[i] > ans_high or next_ans_low > next_ans_high:
        print(-1)
        exit()

    ans_high = next_ans_high
    ans_low = next_ans_low

    # print(A[i], ans_low, ans_high)

print(ans_low, ans_high)


Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;
typedef pair<int,int> P;
bool f(P p1,P p2){
	return p1.second > p2.second;
}
int main(){
	P p[200],tp;
	int a,b,dx[] = {-1,0,1,0},dy[] = {0,1,0,-1},x,y,n;
	while(cin >> n,n){
		tp.first = 0;
		tp.second = 0;
		p[0] = tp;
		for(int i = 0;i < n - 1;++i){
			cin >> a >> b;
			tp.first = p[a].first + dx[b];
			tp.second = p[a].second + dy[b];
			p[i + 1] = tp;
		}
		sort(p,p+n);
		x = abs(p[0].first - p[n - 1].first) + 1;
		sort(p,p+n,f);
		y = abs(p[0].second - p[n - 1].second) + 1;
		cout << x << " " << y << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
<?php

$n = trim(fgets(STDIN));

$下一桁 = (int)($n[strlen($n) - 1]);

if (in_array($下一桁, [2, 4, 5, 7, 9], true)) {
    echo "hon\n";
    exit;
}

if (in_array($下一桁, [0, 1, 6, 8], true)) {
    echo "pon\n";
    exit;
}

echo "bon\n";


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

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		int t;
		cin >> t;
		if (t < A || B <= t) {
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}

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

public class Main {

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

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

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        String S = fs.nextToken();
        String T = fs.nextToken();

        System.out.println(substring(S, T)? "Yes": "No");

    }

    private static boolean substring(String s, String t) {
        if (s.length() >= t.length()) {
            return false;
        }

        for (int i = 0; i < s.length(); ++i) {
            if (s.charAt(i) != t.charAt(i)) {
                return false;
            }
        }

        return true;
    }
}


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

int main(){
	ll n,m; cin >> n >> m;
   if(n == m)cout << "Yes" << endl;
   else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    for (int h = 1; h <= 3500; h++) {
      for (int n = 1; n <= 3500; n++) {
        if (4 * h * n - N * n - N * h == 0) {
          continue;
        }
        long w = (N * h * n) / (4 * h * n - N * n - N * h);
        long mod = (N * h * n) % (4 * h * n - N * n - N * h);
        if (1 <= w && w <= 3500 && mod == 0) {
          System.out.println(h + " " + n + " " + w);
          return;
        }
      }
    }
  }
}

Measured memory_bytes: 23764
N,M=map(int, input().split())
G=[list() for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)
ans=0
index=-1
for i in range(1,N):
    for p in G[i]:
        if index<p<i:
            ans+=1
            index=i-1
print(ans)


Measured memory_bytes: 59040
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<climits>
#define gc getchar()
using namespace std;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
int main()
{
	int a,b,c,x,y,ans=INT_MAX;
	scanf("%d%d%d%d%d",&a,&b,&c,&x,&y);
	for(int i=0;i<=max(x,y);i++)
		ans=min(ans,i*2*c+max(0,x-i)*a+max(0,y-i)*b);
	return !printf("%d\n",ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,ans=0,v;
  cin >> n;
  for(int i=1;i<=n/2;i++){
    v = n-i;
    if(v!=i){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

long long mata[100][100],matb[100][100];

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

    scanf("%lld %lld %lld",&n,&m,&l);

    for(i = 0;i < n;i++)
        for(j = 0;j < m;j++)
            scanf("%lld",&mata[i][j]);

    for(i = 0;i < m;i++)
        for(j = 0;j < l;j++)
            scanf("%lld",&matb[i][j]);

    for(i = 0;i < n;i++){
        for(j = 0;j < l;j++){
            sum = 0;
            for(k = 0;k < m;k++){
                sum += mata[i][k] * matb[k][j];
            }
            printf("%lld",sum);
            if(j < l - 1)
                printf(" ");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 760
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(n);
    cii(a);
    cii(b);
    int ans = min(n * a, b);
    co(ans);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main() {
	int a,b,c,k;
	scanf("%d %d %d %d",&a,&b,&c,&k);
	if (a>=k)
		printf("%d\n",k);
	else if (a+b>=k)
		printf("%d\n",a);
	else if (a+b<k)
		printf("%d\n",2*a+b-k);
	return 0;
}


Measured memory_bytes: 1732
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl
#define puts(a) cout << (a) << " "

#define llint long long int

#define INF (long long)(1e9+1)
#define MOD (long long)(1e9+7)
#define INF64 (long long)(1e18+1)

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 1000000

int main (void)
{
  //INPUT
  llint N,M;
  cin >> N >> M;
  // vector<llint> A(N);
  // rep(i,0,N) {
  //   cin >> A[i];
  // }
  llint buf;
  priority_queue<llint> pq;
  rep(i,0,N) {
    cin >> buf;
    pq.push(buf);
  }

  //SOLVE
  llint ans=0;
  rep(i,0,M) {
    buf = pq.top();
    pq.pop();
    buf /= 2;
    pq.push(buf);
  }
  rep(i,0,N) {
    ans += pq.top();
    pq.pop();
  }

  //OUTPUT
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;

#define INF -(1LL<<61)

typedef struct ST{ 
	vector<ll> a;
	int n;
	void init(vector<ll> &b){
		int size= b.size();
		n=1;
		while(n<size) n*=2;
		a =vector<ll> (2*n-1,INF);
		for(int i=0;i<size;i++)	a[i+n-1] = b[i];
		for(int i=n-2;i>=0;i--) a[i] = max(a[i*2+1],a[i*2+2]); //RMQ
	}
	void update(int k,ll val){
		k+=n-1;
		a[k] = val;
		while(k>0){
			k = (k-1)/2;
			a[k] = max(a[k*2+1],a[k*2+2]);//RMQ
		}
	}
	// [aa,b)の最小値
	// kは節点番号l,rはその節点が[l,r)に対応
	// get(aa,b,0,0,n)
	ll get(int aa,int b,int k,int l,int r){
		//[aa,b)に完全に[l,r)が含んでいる場合 この節点
		if(aa<=l && r<=b) return a[k];
		
		//[aa,b)と[l,r)が交差しなければ INF
		if(r<=aa || b<=l) return INF;
		ll vl = get(aa,b,k*2+1,l,(l+r)/2);
		ll vr = get(aa,b,k*2+2,(l+r)/2,r);
		return max(vl,vr);
	}
	ll find(int aa,int b){
		return get(aa,b,0,0,n);
	}	
}ST;



int main(){
	ll n;
	cin>>n;
	vector<mp> c(n);
	ll s = 0;
	for(ll i=0;i<n;i++){
		ll a,b;
		cin>>a>>b;
		c[i] = mp(a,b);
		s += b;
	}
	sort(c.begin(),c.end());
	vector<ll> sum(n,0),u(n,0),l(n,0);
	sum[0] = c[0].second;
	l[0] = c[0].first;
	u[0] = -c[0].first+c[0].second;

	for(ll i= 1;i<n;i++){
		sum[i] = sum[i-1] + c[i].second;
		u[i] = sum[i] - c[i].first;
		l[i] = c[i].first -sum[i-1];
	}
	ST seg;
	seg.init(u);
	 s= 0;
	for(int i=0;i<n;i++){
		s = max(s,l[i]+seg.find(i,n) );
	}

	cout<<s<<endl;



	return 0;
}



Measured memory_bytes: 38796
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	@SuppressWarnings("unchecked")
	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		List<Integer>[] lists = new ArrayList[n];
		int[] deg = new int[n];
		for (int i = 0; i < n; i++)
			lists[i] = new ArrayList<Integer>();
		for (int i = 0; i < m; i++) {
			int w = scanner.nextInt() - 1;
			int l = scanner.nextInt() - 1;
			lists[w].add(l);
			deg[l]++;
		}
		Deque<Integer> deque = new ArrayDeque<Integer>();
		for (int i = 0;i<n;i++)
			if (deg[i] == 0)
				deque.push(i);
		boolean flag = false;
		while (!deque.isEmpty()) {
			if (deque.size() > 1)
				flag = true;
			int a = deque.poll();
			System.out.println(a + 1);
			for (int x : lists[a]) {
				deg[x]--;
				if (deg[x] == 0)
					deque.push(x);
			}
		}
		System.out.println(flag ? 1 : 0);

	}
}

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

using namespace std;

#define INF int(1e9)

int dp[100000000];

int main() {
  int N; cin >> N;
  vector<int> v(N+1);
  
  for (int i = 1; i <= N; i++) cin >> v[i];
  
  dp[0] = 0;
  dp[1] = 0;
  dp[2] = abs(v[2] - v[1]);
  
  for (int i = 3; i <= N; i++) {
    dp[i] = min(dp[i-2] + abs(v[i] - v[i-2]), dp[i-1] + abs(v[i] - v[i-1]));
  }
  
  cout << dp[N] << endl;
  return 0;
}

Measured memory_bytes: 1024