akhauriyash/Code-Regression huggingface dataset:
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

int d[100005];

void devisor(int r,int n){
    for (int i=r;i<=n;i++){
        for (int j=i;j<=n;j+=i) 
            d[j]++;
    }
}

inline void solve(){
    int  n, k, ans = 0; 
    cin >> n >> k ;
    for (int b=1;b<=n;b++ ) {
        int m=(n+1)/b;
        ans += m*max(0LL,b-k); 
        if (k==0) ans--; 
        ans += max(0LL,(n+1)%b-k);
    } 
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3516
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <queue>
#include <string>

#define REP(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = (s); i < (n); i++)
#define ALLOF(c) c.begin(), c.end()
#define RANGEOF(c,i,n) c.begin() + (i), c.begin() + (i) + (n)
#define EPS 1e-9
#define INF 1000000000
using namespace std;

template <class T> T read() { T t; cin >> t; return t; }
template <class T> vector<T> read(int n) { vector<T> v; REP(i,n) { v.push_back(read<T>()); } return v; }
template <class T> vector<vector<T>> read(int n, int m)
{
	vector<vector<T>> v;
	REP(i,n) { v.push_back(read<T>(m)); }
	return v;
}

template <class T> void write(const T &t) { cout << t << endl; }
template <class T> void write(const T &t, const T &t2) { cout << t << ' ' << t2 << endl; }
template <class T> void write(const vector<T> &v)
{
	ostringstream ss; 
	for (auto x : v) ss << x << ' ';
	auto s = ss.str();
	cout << s.substr(0, s.length() - 1) << endl;
}

struct _Reader { template <class T> _Reader operator ,(T &rhs) { cin >> rhs; return *this; } };
#define READ(t,...) t __VA_ARGS__; _Reader(), __VA_ARGS__

void solve();
int main() { solve(); return 0; }

/// template end ///



void solve()
{
	while (true)
	{
		READ(int, N,Q);
		if (!N) { break; }

		vector<int> list;
		REP(i,N)
		{
			READ(int, M);
			auto l = read<int>(M);
			list.insert(list.end(), ALLOF(l));
		}

		int maxMembers = 0;
		int index = 0;
		REP(i, 101)
		{
			auto c = count(ALLOF(list), i);
			if (c > maxMembers) { maxMembers = c; index = i;  }
		}
		write(maxMembers >= Q ? index : 0);
	}
}

Measured memory_bytes: 1244
n = int(input())
B = list(map(int, input().split()))
BMax = max(B) + 1
A = [BMax for i in range(n)]
for i in range(n - 1):
    A[i] = min(B[i], A[i])
    A[i + 1] = min(A[i + 1], B[i])
print(sum(A))

Measured memory_bytes: 3060
#include<stdio.h>
int main (){
	int S,h,m,s;
	scanf("%d",&S);
        h=S/3600;
        m=(S-h*3600)/60;
        s=S-h*3600-m*60;
	printf("%d:%d:%d\n",h,m,s);
            return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a,b;
	float c;
	cin >> a >> b;
	c = b*2-1;
	if (a - c >= 0)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
}



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

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> player(100);
    for (int i = 0; i < N; i++) {
        cin >> player[i].first >> player[i].second;
    }
    vector<pair<int, int>> checkp(100);
    for (int i = 0; i < M; i++) {
        cin >> checkp[i].first >> checkp[i].second;
    }
    for (int i = 0; i < N; i++) {
        int manh = 2000000000;
        int num;
        for (int j = 0; j < M; j++) {
            int absx = abs(player[i].first - checkp[j].first);
            int absy = abs(player[i].second - checkp[j].second);
            if (manh > absx + absy) {
                manh = absx + absy;
                num = j + 1;
            }
        } 
        cout << num << endl;
    }
}

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

using namespace std;

string s;

int main()
{
    int n,k;
    cin>>n>>k;
    cin>>s;
    s="1"+s;
    int tmp=k;
    int r=1;
    for(int i=1;i<=n;i++)
    {
        if(s[r]=='0'&&s[r-1]=='1')
        {
            if(tmp)
            {
                tmp--;
                r++;
            }
            else break;
        }
        else
        {
            r++;
        }
    }
    int ans=r-1;
    for(int i=2;i<=n;i++)
    {
        if(s[i]=='1'&&s[i-1]=='0')
        {
            int tmp=1;
            while(r<=n)
            {
                if(s[r]=='0'&&s[r-1]=='1')
                {
                    if(tmp)
                    {
                        tmp--;
                        r++;
                    }
                    else break;
                }
                else
                {
                    r++;
                }
            }
            ans=max(ans,r-i);
        }
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 512
n = int(input())
a = list(map(int,input().split()))
b1 = 0
b2 = 0
b4 = 0
for i in range(n):
  if a[i] % 4 == 1 or a[i] % 4 == 3:
    b1 += 1
  elif a[i] % 4 == 2:
    b2 += 1
  else:
    b4 += 1
if b2 == 0:
  if b1 - 1 > b4:
    print('No')
  else:
    print('Yes')
else:
  if b1 > b4:
    print('No')
  else:
    print('Yes')

Measured memory_bytes: 14252
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

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

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

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	int n, m; cin >> n >> m;

	vector<int> a(m+1);


	for (int i = 0; i < n; i++) {
		int k; cin >> k;

		for (int i = 0; i < k; i++) {
			int x; cin >> x;

			a[x]++;
		}
	}

	int ans = 0;
	for (int i = 0; i < m+1; i++) {
		if (a[i] == n) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

a,b = input().split()
a = int(a)
b = list(b.split("."))
b = ''.join(b)
b = int(b)
print(a*b//100)

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

using ld = long double;
const ld eps = 1e-8, pi = acos(-1.0);

bool eq(ld a, ld b) {
	return abs(a - b) < eps;
}

using point = complex<ld>;

ld dot(point a, point b) {
	return real(conj(a) * b);
}

ld cross(point a, point b) {
	return imag(conj(a) * b);
}

int ccw(point a, point b, point c) {
	b -= a, c -= a;
	if (cross(b, c) > eps) return 1;	// a,b,c counter-clockwise
	if (cross(b, c) < -eps) return -1;	// a,b,c clockwise
	if (dot(b, c) < 0) return 2;		// c,a,b on a line
	if (norm(b) < norm(c)) return -2;	// a,b,c on a line
	return 0;							// a,c,b on a line
}

struct line {
	point a, b;
	line() : a(), b() {}
	line(const point& a_, const point &b_)
		: a(a_), b(b_) {}
};

bool isis_ll(line l, line m) {
	return abs(cross(l.b - l.a, m.b - m.a)) > eps;
}

bool isis_ls(line l, line s) {
	return (cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < eps);
}

bool isis_lp(line l, point p) {
	return abs(cross(l.b - p, l.a - p)) < eps;
}

bool isis_sp(line s, point p) {
	return abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a) < eps;
}

point proj(line l, point p) {
	ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + t * (l.a - l.b);
}

point is_ll(line s, line t) {
	point sv = s.b - s.a, tv = t.b - t.a;
	assert(cross(sv, tv) != 0);
	return s.a + sv * cross(tv, t.a - s.a) / cross(tv, sv);
}

bool isis_ss(line s, line t) {
	if (isis_ll(s, t)) return isis_ls(s, t) && isis_ls(t, s);
	return isis_sp(s, t.a) || isis_sp(s, t.b) || isis_sp(t, s.a);
}

ld dist_lp(line l, point p) {
	return abs(p - proj(l, p));
}

ld dist_ll(line l, line m) {
	return isis_ll(l, m) ? 0 : dist_lp(l, m.a);
}

ld dist_ls(line l, line s) {
	return isis_ls(l, s) ? 0 : min(dist_lp(l, s.a), dist_lp(l, s.b));
}

ld dist_sp(line s, point p) {
	point r = proj(s, p);
	return isis_sp(s, r) ? abs(r - p) : min(abs(s.a - p), abs(s.b - p));
}

ld dist_ss(line s, line t) {
	if (isis_ss(s, t)) return 0;
	return min({ dist_sp(s, t.a), dist_sp(s, t.b), dist_sp(t, s.a), dist_sp(t, s.b) });
}

vector<point> convex_hull(vector<point> ps) {
	sort(ps.begin(), ps.end(), [](const point& a, const point& b) {
		return a.real() == b.real() ? a.imag() < b.imag() : a.real() < b.real();
	});
	int k = 0;
	const int n = ps.size();
	vector<point> qs(n + 1);
	for (int i = 0; i < n; ++i) {
		while (k > 1 && ccw(qs[k - 2], qs[k - 1], ps[i]) <= 0) {
			k--;
		}
		qs[k++] = ps[i];
	}
	for (int i = n - 2, t = k; i >= 0; --i) {
		while (k > t && ccw(qs[k - 2], qs[k - 1], ps[i]) <= 0) {
			k--;
		}
		qs[k++] = ps[i];
	}
	qs.resize(k - 1);
	return qs;
}

bool is_convex(const vector<point>& ps) {
	const int n = ps.size();
	if (n < 3) return false;
	for (int i = 0; i < n; i++) {
		int c = ccw(ps[i], ps[(i + 1) % n], ps[(i + 2) % n]);
		if (c == -1) return false;
	}
	return true;
}

int main()
{
	int n;
	cin >> n;
	vector<point> ps;
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		ps.emplace_back(x, y);
	}
	cout << is_convex(ps) << endl;
	return 0;
}



Measured memory_bytes: 3176
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	int T,X;
	scanf("%d %d", &X, &T);
	printf("%f\n", X/(double)T);


	return 0;

}


Measured memory_bytes: 256
n,m,x,y = gets.chomp.split(" ")
list = gets.chomp.split(" ")
list_y,list_x =[],[]
for i in list
  list_x.push(i.to_i)
end
list = gets.chomp.split(" ")
for i in list
  list_y.push(i.to_i)
end

list_x = list_x.sort.reverse
list_y = list_y.sort

if list_x[0] > x.to_i && list_y[0] <= y.to_i && list_x[0] < list_y[0]
  puts "No War"
else
  puts "War"
end


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
char ans[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    string s;
    int pos=0;
    cin>>s;
    for(int i=0; i<s.length(); i++)
    {
        if(s[i]!='B')
            ans[pos++]=s[i];
        else
            pos--;
        pos=max(pos,0);
    }
    for(int i=0;i<pos;i++)
        cout<<ans[i];

    return 0;
}


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

int main(){
  char b;
  cin >> b;
  if(b == 'A') cout << 'T' << endl;
  else if(b == 'T') cout << 'A' << endl;
  else if(b == 'G') cout << 'C' << endl;
  else if(b == 'C') cout << 'G' << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int k = 0;
    int times = 1;
    int cnt = 0;
    while(k < N) {
        for(int i = 0; i < 9; i++) {
            k += times;
            if (k <= N) cnt++;
        }
        times *= 10;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

char dx[] = {-1,0,-1};
char dy[] = {-1,-1,0};
char g[1001][1001];

int main(){
	char m[1001][1001], c[3];
	int n, min, max;

	while(1){
		scanf("%d", &n);
		if(n==0) break;
		max = 0;
		
		for(int i=0 ; i<n ; i++){
			scanf("%s", g[i]);
		}
		
		for ( int i = 0; i < n; i++ ) {
			m[0][i] = (g[0][i] == '*') ? 0 : 1;
			m[i][0] = (g[i][0] == '*') ? 0 : 1;
		}
		for(int y=1 ; y<n ; y++){
			for(int x=1 ; x<n ; x++){
				if( g[y][x] == '*' ){
					m[y][x] = 0;
				}
				else{
					min = 1000;
					for(int i=0 ; i<3 ; i++){
						int mx = x + dx[i];
						int my = y + dy[i];
						c[i] = m[my][mx];
					}
					for(int i=0 ; i<3 ; i++){
						if(c[i]<min) min = c[i];
					}
					m[y][x] = min + 1;
					if(max<m[y][x]) max = m[y][x];
				}
			}
		}
		printf("%d\n", max);
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using ll = long long;
using namespace std;
int ketasum(int n) {
	int ans = 0, x = 10, i = 1;
	while (n > 0) {
		ans += ((n % x) / i);
		n -= (n % x);
		x *= 10;
		i *= 10;
	}
	return ans;
}
int main() {
	int n, m, A[101010], B[101010];
	cin >> n;
	if (n != 10 && n != 100 && n != 1000 && n != 10000 && n != 100000)
		cout << ketasum(n) << endl;
	else
		cout << 10 << endl;
	return 0;
}

Measured memory_bytes: 256
L, R = map(int, input().split())
if R - L >= 2019:
    ans = 0
else:
    tmp_min = 10 ** 7
    for i in range(L, R+1):
        for j in range(L, R+1):
            if i <= j:
                pass
            else:
                tmp = ((i % 2019) * (j % 2019)) % 2019
                if tmp < tmp_min:
                    tmp_min = tmp

    ans = tmp_min
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=1e6;
ll d[mm];
ll vis[mm];
ll vv[mm];
ll dd[mm];
ll ddd[mm];
int main()
{
	ll n,m,i,j,x,a,k,z,p,u,s,kk,ss;
	cin>>n>>kk;
	for(i=1;i<=n;i++)
	scanf("%lld",&d[i]);
	k=d[1];
	s=1;
	vis[1]=1;
	dd[0]=1; 
	while(1)
	{
		if(vis[k]==0)
		vis[k]=1;
		else 
		break;
		dd[s++]=k;
		k=d[k];
	}
	if(kk<s)
	printf("%lld\n",dd[kk]);
    else
    {
    kk-=s;
    ddd[0]=k;
    vv[k]=1;
    s=1;
    k=d[k];
    while(1)
	{
		if(vv[k]==0)
		vv[k]=1;
		else 
		break;
		ddd[s++]=k;
		k=d[k];
	}
//    cout<<s<<endl;
	printf("%lld\n",ddd[kk%s]);
//	cout<<s<<' '<<kk%s<<endl;
    }
	

}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;
const ll 	N 		= 	2*1e6;

/*vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,m;
string s,t;
//vll a;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	ll a,b,c;
	cin>>a>>b>>c>>x>>y;
	ll mini = min(x,y);
	ll maxi = max(x,y);
	x-=mini;
	y-=mini;

	ll cou = min( mini * min(a+b,2*c) + a*x + b*y, maxi * min(a+b,2*c));

	cout<<cou;
}

int main() {
	fastio;randomINT;
	//cin>>T;
	while(T--) {
		MAIN();
	}
	return 0;
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
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;}
const ll INF = 1LL << 60;

vector<vll> dp(110, vll(100100, INF));

int main(){
    int n, weight;
    cin >> n >> weight;
    vi w(n), v(n);
    rep(i, n){
        cin >> w.at(i) >> v.at(i);
    }
    dp.at(0).at(0) = 0;
    rep(i, n){
        rep(j, 100100){
            if(j-v.at(i) >= 0)
            chmin(dp.at(i+1).at(j), dp.at(i).at(j-v.at(i)) + w.at(i));
            chmin(dp.at(i+1).at(j), dp.at(i).at(j));
        }
    }
    ll value_max = 0;
    rep(i, n*1000+1){
        if(dp.at(n).at(i) <= weight)
            value_max = i;
    }
    cout << value_max << endl;
    return 0;
}

Measured memory_bytes: 87296
while True:
    a, op, b = input().split()
    if op == "+":
        print(int(a)+int(b))
    elif op == "-":
        print(int(a)-int(b))
    elif op == "/":
        print(int(a)//int(b))
    elif op == "*":
        print(int(a)*int(b))
    else:
        break


Measured memory_bytes: 5596
#define _USE_MATH_DEFINES

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

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

    cout<<n*m<<endl;
    return 0;

} // end of main


//実行は、Opt + Ctl + N
//デバッグする場合は、デバッグビューでドロップダウンリストから[(lldb)Launch]を選択する
//まずビルド: Command + Shift + B
//その後、F5
//ターミナルが開くので、入力はそちらに。
//F9でブレークポイント設置
//F11でステップイン実行

Measured memory_bytes: 3632
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> Q;
//ll longinf=1ll<<60;
int inf=1<<29;
int dh[4]={1,0,-1,0};
int dw[4]={0,1,0,-1};
ll longinf=(1ll<<31)-1;

int main(){
      int n;
      cin>>n;
      int k=0;
      REP(i,2,2000){
            if(n==(i*(i-1))/2){
                  k=i;
            }
      }
      if(k==0){
            cout<<"No"<<endl;
            return 0;
      }
      cout<<"Yes"<<endl;
      int d[k][k];
      rep0(i,k) d[i][i]=0;
      int cnt=1;
      rep0(i,k){
            for(int j=(i+1);j<k;j++){
                  d[i][j]=d[j][i]=cnt;
                  cnt++;
            }
      }
      /*rep0(i,k){
            rep0(j,k){
                  cout<<d[i][j]<<" ";
            }
            cout<<endl;
      }*/
      cout<<k<<endl;
      rep0(i,k){
            cout<<k-1<<" ";
            rep0(j,k){
                  if(d[i][j]) cout<<d[i][j]<<" ";
            }
            cout<<endl;
      }
      return 0;
}

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

int main(){
    string S;
    cin >> S;
    vector<int> g(S.size()+1);
    g.at(0) = 0;
    g.at(1) = 1;
    if(S.size()<2){
        cout << 1 << endl;
        return 0;
    }
    if(S.at(0)==S.at(1)){
        g.at(2) = 1;
    }else{
        g.at(2) = 2;
    }
    for(int i=3;i<=S.size();++i){
        if(S.at(i-2)==S.at(i-1)){
            g.at(i) = g.at(i-3)+2;
        }else{
            g.at(i) = g.at(i-1)+1;
        }
    }
    cout << g.at(S.size()) << endl;
}

Measured memory_bytes: 1412
#include "bits/stdc++.h"
using namespace std;

int main(){
string o,e;
cin >> o >> e;
if(o.size() == e.size()){
 for(int i=0;i<o.size();i++){
   cout << o.at(i)<<e.at(i);
 }
 cout << endl;
}
else{
  for(int i=0;i<e.size();i++){
    cout << o.at(i)<<e.at(i);

  }
  cout << o.back() << endl;
}
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef vector<lint> vlint;

#define inf 1e+9
#define endl "\n"
#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 all(x) (x).begin(), (x).end()

#define m0(x) memset(x, 0, sizeof(x))
#define fill(x, y) memset(x, y, sizeof(x))

#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))

template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

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

int main(){
    int a; cin >> a;
    cout << a + a*a + a*a*a << endl;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}
template<typename T,typename U>
ll FindErase(T &v,U tar){
  ll cnt = 0;
  for(auto it = v.begin(); it != v.end();){
    if(*it == tar){
      it = v.erase(it);
      ++cnt;
    }
    else{
      ++it;
    }
  }
  return cnt;
}

template<typename T>
bool SuffixErase(T &v,size_t suf){
  if(suf > v.size()) return false;
  for(auto it = v.begin(); it != v.end();){
    if(distance(v.begin(),it) == suf){
      v.erase(it);
      return true;
    }
    else{
      ++it;
    }
  }
  return false;
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<ll> a(4);
  ll b,c;
  rep(i,4){
    cin >> a[i];
  }
  cin >> b >> c;
  sort(all(a));
  cout << max(b,c) + a[1] + a[2] + a[3] << endl;

  return 0;
}

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

using namespace std;

int main(){
	long long n, ans = (long long)1e18;
	cin >> n;
	vector<long long> a(n + 1);
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		a[i] += a[i - 1];
	}
	for(int i = 1; i < n; i++){
		long long x, y;
		x = a[i];
		y = a[n] - a[i];
		ans = min(ans, abs(x - y));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<regex>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
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;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    string st;cin>>st;
    regex re("A?KIHA?BA?RA?");
    if(regex_match(st,re)){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}

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

int main(){
        int n; cin>>n;
        int a[2][n];
        for(int i=0;i<2;i++){
                for(int j=0;j<n;j++){
                        cin>>a[i][j];
                }
        }
        int res=0;
        for(int i=0;i<n;i++){
                int tmp=0;
                for(int j=0;j<n;j++){
                        if(j<i) tmp+=a[0][j];
                        else if(j==i) tmp=tmp+a[0][j]+a[1][j];
                        else tmp+=a[1][j];
                }
                res=max(res,tmp);
        }
        cout<<res<<endl;
        return 0;
}

Measured memory_bytes: 256
def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

ABCD = list(map(int, input()))

for i in range(2**3):
    operand = []
    tmp = ["+", "-"]
    
    for j in range(3):
        if (i >> j) & 1:
            operand.append(tmp[0])
        else:
            operand.append(tmp[1])
    
    flg = ABCD[0]
    ans = str(ABCD[0]) 
    
    for k in range(3):
        if operand[k] == "+":
            flg += ABCD[k + 1]
            ans += operand[k]
            ans += str(ABCD[k + 1])
        
        else:
            flg -= ABCD[k + 1]
            ans += operand[k]
            ans += str(ABCD[k + 1])
    
    if flg == 7:
        print(ans + "=7")
        break

Measured memory_bytes: 61920
#include<iostream>
using namespace std;
int main(){
	int a,b,c,d,n[101],m=0;
	for(int i=0;i<=101;i++){
		n[i]=0;
	}
	cin>>a>>b>>c>>d;
	for(int i=a;i<=b;i++){
		n[i]++;
	}
	for(int i=c;i<=d;i++){
		n[i]++;
	}
	for(int i=0;i<=101;i++){
		if(n[i]==2){
			m++;
		}
	}
	if(m==0){
		cout<<0;
	} else {
		cout<<m-1;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

//Amida, the City of Miracle
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			int a = sc.nextInt();
			if((n|m|a)==0)break;
			int[][] r = new int[1002][n+1];
			while(m--!=0){
				int h = sc.nextInt();
				int p = sc.nextInt();
				int q = sc.nextInt();
				r[h][p] = q;
				r[h][q] = p;
			}
			int pos = a;
			for(int h=1000;h>0;h--){
				if(r[h][pos]!=0)pos = r[h][pos];
			}
			System.out.println(pos);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
X, K, D = map(int,input().split())

if X + K*D < 0:
    print(abs(X + K*D))
elif X - K*D > 0:
    print(X - K*D)
else:
    if abs(X)//D%2 == K%2:
        print(abs(abs(X)%D))
    else:
        print(abs(D-abs(X)%D))

Measured memory_bytes: 61652
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	int cnt;
	int n;
	int m;
	int array[];
	ArrayList<Integer> g;
	public static void main(String args[]) {
		Main m = new Main();
		m.shellSort();
		m.printAnswer();
	}
	public Main() {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = scan.nextInt();
		}
		g = new ArrayList<Integer>();
	}
	public void printAnswer() {
		System.out.println(g.size());
		for(int i = 0; i < g.size(); i++) {
			System.out.print((i == 0?"":" ") + g.get(i));
		}
		System.out.println();
		System.out.println(cnt);

		for(int i = 0; i < n; i++) {
			System.out.print((i == 0?"":"\n") + array[i]);
		}
	}
	public void insertionSort(int g) {
		for (int i  = g; i < n; i++) {
			int v = array[i];
			int j = i;
			while (j >= g && array[j - g] > v){
				array[j] = array[j - g];
				j -= g;
				cnt++;
			}
			array[j] = v;
		}
	}
	public void shellSort() {
		cnt = 0;
		m = 0;
		while(true){
			int tm = m * 3 + 1;
			if (m > n / 9) break;
			m = tm;
		}
		while (m > 0) {
			insertionSort(m);
			g.add(m);
			m /= 3;
		}
	}
}



Measured memory_bytes: 307084
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scn = new Scanner(System.in)) {
			long A = scn.nextLong();
			long B = scn.nextLong();
			long C = scn.nextLong();
			long D = scn.nextLong();

			long minmaxVal = B - A + 1;
			long cd = lcm(C, D);
			long div = B / cd - ((A - 1) / cd);
			long cDiv = (A - 1) / C - B / C;
			long dDiv = (A - 1) / D - B / D;

			System.out.println(minmaxVal + div + cDiv + dDiv);

		}
	}

	static long lcm (long a,long b) {
		long temp;
		long c = a;
		c *= b;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return c/b;
	}
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <stdlib.h>
#define N 200000
#define M 20000
int c[N], primes[M], v[M];

int comp(const void* a, const void* b) { return *((int*)a)>*((int*)b); }
int main(void)
{
    int i, j, k, n, p, pc;
    for(pc=0,i=2;i<N;++i) if (!c[i]) {
        primes[pc++]=i;
        for(j=i+i;j<N;j+=i) c[j]=1;
    }

    while (scanf("%d%d", &n, &p), ~n) {
        int x;
        for(k=0;k<pc;++k) if (primes[k]>n) break;
        x=0;
        for(i=k;i<k+100;++i) for(j=i;j<k+100;++j)
            v[x++]=primes[i]+primes[j];
        qsort(v, x, sizeof(int), comp);
        printf("%d\n", v[p-1]);
    }
    return 0;
}

Measured memory_bytes: 1532
import java.awt.*;
import java.awt.geom.*;
import java.io.*;

import java.util.*;
class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(a == 0 && b == 0) break;
			
			System.out.println((a < b)?(a + " " + b):(b + " " + a));
		}
	}
}

Measured memory_bytes: 27300
#include <stdio.h>

int search(int A[],int n,int key)
{
    int i = 0;
    A[n] = key;
    while(A[i] != key) i++;
    return  i != n;
}

int main()
{
    int i,n,A[10001],q,key,sum = 0;
    scanf("%d",&n);
    for (int i = 0; i < n; i++)
        scanf("%d",&A[i]);
    scanf("%d",&q);
    for (int i = 0; i < q; i++)
    {
        scanf("%d",&key);
        if(search(A,n,key)) sum++;
    }
    printf("%d\n",sum);
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  
  bool t = false;
  if(s[0]=='A') {
    for(int i=2;i<s.size()-1;i++) {
      if(s.at(i)=='C') {
	int num=i;
	int sum=0;
	for(int j=1;j<s.size();j++) {
	  if(j==num) continue;

	  if('z'-s.at(j)>=0 && 'z'-s.at(j)<26 ) sum++;
	  if(sum==s.size()-2) t=true;
	}//cout << sum << endl;
      }
    }
  }
  if(t) cout << "AC" << endl;
  else cout << "WA" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
  #define N 100
  #define SHIRO 0
  #define HAI 1
  #define KURO 2

  int n,M[N][N];
  int iro[N],f[N],d[N],tt;

  void vdepth(int u){
    int v;
    iro[u]=HAI;
    d[u]=++tt;
    for(v=0;v<n;v++){
      if(M[u][v]==0)continue;
      if(iro[v]==SHIRO){
        vdepth(v);
      }
    }
    iro[u]=KURO;
    f[u]=++tt;
  }

  void def(){
    int u;
    for(u=0;u<n;u++)iro[u]=SHIRO;
    tt=0;
    for(u=0;u<n;u++){
      if(iro[u]==SHIRO)vdepth(u);
    }
    for(u=0;u<n;u++){
      printf("%d %d %d\n",u+1,d[u],f[u]);
    }
  }

  int main(){
    int u,v,k;

    scanf("%d",&n);
    int i,j;
    for(i=0;i<n;i++){
      for(j=0;j<n;j++)M[i][j]=0;
    }
    for(i=0;i<n;i++){
      scanf("%d %d",&u,&k);
      u--;
      for(j=0;j<k;j++){
        scanf("%d",&v);
        v--;
        M[u][v]=1;
      }
    }

    def();
    return 0;
  }

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N; scanf("%d", &N);
  vector<int> A(N), B(N), C(N);
  for (int i = 0; i < N; ++i) {
    scanf("%d", &A[i]);
  }
  for (int i = 0; i < N; ++i) {
    scanf("%d", &B[i]);
  }
  for (int i = 0; i < N; ++i) {
    scanf("%d", &C[i]);
  }
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());
  ll ans = 0LL;
  for (int i = 0; i < N; ++i) {
    int val = B[i];
    ans += 1LL * distance(A.begin(), lower_bound(A.begin(), A.end(), val)) *
           distance(upper_bound(C.begin(), C.end(), val), C.end());
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>

using namespace std;
int main(void)
{
	int H,W;
	cin >> H >> W;

	char pix[H][W];
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin >> pix[i][j];
		}
	}

	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cout << pix[i][j];
		}
		cout << endl;
		for(int j=0;j<W;j++){
			cout << pix[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//i ll be the king
#include<bits/stdc++.h>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define f first
#define s second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_orde(ind)
using namespace std;
int main()
{
	sync;
	string s;
	cin>>s;
	ll a=(s[0]-'0')*10+s[1]-'0',b=(s[2]-'0')*10+s[3]-'0';//cout<<a<<" "<<b<<endl;
	if(a>0&&a<=12&&b>0&&b<=12)
	cout<<"AMBIGUOUS";	
	else if(a<=12&&a>0&&(b>12||b==0))
	cout<<"MMYY";
	else if(b<=12&&b>0&&(a>12||a==0))
	cout<<"YYMM";
	else
	cout<<"NA";
}
	

Measured memory_bytes: 256
// Problem : C - Vacation
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("O3")  
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define pii pair<int,int>
#define S second
#define endl "\n"
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define mem(z,i) memset(z,i,sizeof(z))
#define eps 1e-7
#define I (int)
#define mod 1000000007
#define pb push_back
const long long INF = 1000000000000000000LL;
//const int WASTE=∞
const int N=1e5+5;
int a[N],b[N],cc[N],dp[N][3],n;
int f(int r,int c,int cv){
	if(dp[r][c]!=-1) return cv+dp[r][c];
	if(r==n-1){
		if(c==0) return cv+a[r];
		else if(c==1) return cv+b[r];
		else return cv+cc[r];
	}
	if(c==0) dp[r][c]=max(f(r+1,1,a[r]),f(r+1,2,a[r]));
	else if(c==1) dp[r][c]=max(f(r+1,0,b[r]),f(r+1,2,b[r]));
	else dp[r][c]=max(f(r+1,0,cc[r]),f(r+1,1,cc[r]));
	return cv+dp[r][c];
}
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
  	// cout<<fixed;
  	// cout.precision(10);
   	cin>>n;
   	for(int x=0;x<n;x++) cin>>a[x]>>b[x]>>cc[x];
   	mem(dp,-1);
   	int ans=max(f(0,0,0),max(f(0,1,0),f(0,2,0)));
   	cout<<ans;
   	
   	
   	
   	
   	
   	
   	
   	
   	
   	
   	
  	return 0;
}



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

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const int MAX { 10000010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

bitset<MAX> sieve;
set<ll> ps;
ll divs[MAX];

void precomp()
{
    sieve.set();
    ps.insert(2);
    ps.insert(3);

    for (ll i = 5, step = 2; i < MAX; i += step, step = 6 - step)
    {
        if (sieve[i])
        {
            ps.insert(i);

            for (ll j = i * i; j < MAX; j += 2*i)
                sieve[j] = false;
        }
    }

    divs[1] = 1;
    divs[2] = 2;
    divs[3] = 2;

    for (ll i = 4; i < MAX; ++i)
    {
        if (ps.count(i))
        {
            divs[i] = 2;
            continue;
        }

        ll x = i;

        for (auto p : ps)
        {
            if (x % p)
                continue;

            ll k = 0;

            while (x % p == 0)
            {
                x /= p;
                ++k;
            }

            divs[i] = (k + 1)*divs[x];
            break;
        }
    }
}

ll solve(ll N)
{
    ll ans = 0;

    for (ll i = 1; i <= N; ++i)
        ans += (i * divs[i]);

    return ans;
}

int main()
{
    ios::sync_with_stdio(false);
    precomp();

    int N;
    cin >> N;

    auto ans = solve(N);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 114132
#pragma GCC optimize(2)

#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstring>

#include <set>
#include <queue>
#include <complex>
#include <algorithm>

int read(void){
	int res = 0, sign = 1;
	char ch = std::getchar();
	while(!std::isdigit(ch)){
		if(ch == '-')
			sign = -1;
		ch = std::getchar();
	}
	while(std::isdigit(ch))
		res = res * 10 + ch - 48, ch = std::getchar();
	return sign * res;
}

template<class Tp>
	void write(const Tp &x){
		if(x > 9)
			write(x / 10);
		std::putchar(x % 10 + 48);
	}

typedef long long ll;
typedef unsigned long long ull;
typedef double rl;
typedef long double RL;

const rl PI = 3.1415926535898, E = 2.71828182845904;

int a, b, c, k;

int main(){
	a = read(), b = read(), c = read(), k = read();
	while(a >= b && k)
		b *= 2, --k;
	while(b >= c && k)
		c *= 2, --k;
	if(a < b && b < c)
		std::puts("Yes");
	else
		std::puts("No");
	return 0;
}

Measured memory_bytes: 1532
#include<bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

int h,w;
int fie[501][501];
vector<P> vec[501][501];
bool flag[501][501];
int sx,sy;
int route[501][501];
int f=0;

void dfs(int y,int x){
	flag[y][x]=true;
	if(fie[y][x]==1){
		f=1;
	}
	if(f==1 && fie[y][x]==0){
		fie[y][x]=2;
	}
	for(int i=0;i<vec[y][x].size();i++){
		P nv=vec[y][x][i];
		if(!flag[nv.first][nv.second]){
			dfs(nv.first,nv.second);
		}
	}
}

int main(void){
	scanf("%d%d",&h,&w);
	for(int i=0;i<h;i++){
		string str;
		cin >> str;
		for(int j=0;j<w;j++){
			if(str[j]=='@'){
				fie[i][j]=3;
				sy=i;
				sx=j;
			}
			if(str[j]=='*'){
				fie[i][j]=1;
			}
		}
	}
	for(int i=0;i<w-1;i++){
		vec[0][i].push_back(P(0,i+1));
		vec[0][i+1].push_back(P(0,i));
	}
	for(int i=0;i<2;i++){
		vec[i][0].push_back(P(i+1,0));
		vec[i+1][0].push_back(P(i,0));
		vec[i][w-1].push_back(P(i+1,w-1));
		vec[i+1][w-1].push_back(P(i,w-1));
	}
	int side=0;
	for(int i=0;i<w-1;i++){
		if(side==0){
			vec[h-1][i].push_back(P(h-1,i+1));
			vec[h-1][i+1].push_back(P(h-1,i));
		}else{
			vec[2][i].push_back(P(2,i+1));
			vec[2][i+1].push_back(P(2,i));
		}
		if((i+1)%2==0){
			side=1-side;
		}
	}
	for(int i=0;i<w;i+=2){
		for(int j=2;j<h;j++){
			vec[j][i].push_back(P(j+1,i));
			vec[j+1][i].push_back(P(j,i));
		}
	}
	dfs(sy,sx);
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(fie[i][j]==0){
				printf(".");
			}
			if(fie[i][j]==1){
				printf("*");
			}
			if(fie[i][j]==2){
				printf("#");
			}
			if(fie[i][j]==3){
				printf("@");
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 9292
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  vector<int> cardNum(N);
  int sumali=0;
  int sumbob=0;
  for(int i=0;i<N;i++){
    cin>>cardNum.at(i);
  }
  
  sort(cardNum.begin(), cardNum.end()); 
  reverse(cardNum.begin(), cardNum.end());
  
  for(int i=0;i<N;i++){
    if((i+1)%2==1)sumali+=cardNum.at(i);
   if((i+1)%2==0)sumbob+=cardNum.at(i);
  }
  cout<<sumali-sumbob<<endl;
}

Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fi first
#define se second
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=3005;
bitset<N>vis;int p[N],m;
void init(int n=3000){
	fp(i,2,n){
		if(!vis[i])p[++m]=i;
		for(R int j=1;j<=m&&1ll*i*p[j]<=n;++j){
			vis[i*p[j]]=1;
			if(i%p[j]==0)break;
		}
	}
}
const int M=1e5+5;
ll a[M];int n,res;
map<ll,int>mp;
typedef map<ll,int>::iterator IT;
int main(){
//	freopen("testdata.in","r",stdin);
	init();
	scanf("%d",&n);
	R ll tmp;
	fp(i,1,n){
		scanf("%lld",&a[i]);
		for(R int j=1;j<=m&&1ll*p[j]*p[j]*p[j]<=a[i];++j){
			tmp=1ll*p[j]*p[j]*p[j];
			while(a[i]%tmp==0)a[i]/=tmp;
		}
		++mp[a[i]];
	}
//	puts("qwq");
	for(IT it=mp.begin();it!=mp.end();++it){
		if(it->fi==1)continue;
		R ll x=it->fi,y=1;
//		cout<<x<<' '<<y<<endl;
		fp(j,1,m)if(x%p[j]==0){
			R int c=0;
			while(x%p[j]==0)x/=p[j],++c;
			(c&1)?(y*=p[j]*p[j]):(y*=p[j]);
		}
		if(x!=1){
			tmp=sqrt(x);
			tmp*tmp==x?(y*=tmp):(y*=x*x);
		}
//		printf("%lld %lld\n",x,y);
		if(!mp.count(y)||it->fi<y)res+=max(it->se,mp.count(y)?mp[y]:0);
	}
	if(mp[1])++res;
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 7296
H, W, A, B = map(int, input().split())
MOD = 10 ** 9 + 7
limit = 2 * 10 ** 5


# modしながらコンビネーションを求める
def mod_cmb(n, r, mod):
    x = fact[n] * fact_inverse[r] % mod
    x = x * fact_inverse[n - r] % mod
    return x


def d_cmb(n, r, mod):
    return mod_cmb(n + r - 1, r, mod)


# modしたa^bを求める
def mod_pow(a, p, mod):
    if p == 0:
        return 1
    elif p % 2 == 1:
        return a * mod_pow(a, p - 1, mod)
    else:
        return (mod_pow(a, p // 2, mod) % mod) ** 2 % mod


fact = [1] * (limit + 1)
fact_inverse = [1] * (limit + 1)

for i in range(1, limit + 1):
    fact[i] = fact[i - 1] * i % MOD

fact_inverse[limit] = mod_pow(fact[limit], MOD - 2, MOD)
for i in reversed(range(1, limit + 1)):
    fact_inverse[i - 1] = fact_inverse[i] * i % MOD

n1 = W
r1 = H - A - 1
n2 = 1
r2 = A - 1
ans = 0
for i in range(W - B):
    ans += d_cmb(n1 - i, r1, MOD) * d_cmb(n2 + i, r2, MOD)
    ans %= MOD

print(ans)

Measured memory_bytes: 18804
import sys
from bisect import bisect_left

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    if len(A) != len(set(A)) or len(B) != len(set(B)):
        print(0)
        exit()
    A.sort()
    B.sort()
    As = set(A)
    Bs = set(B)
    res = 1
    for x in reversed(range(1, n * m + 1)):
        if x in As and x in Bs:
            continue
        elif x in A:
            res *= m - bisect_left(B, x)
        elif x in B:
            res *= n - bisect_left(A, x)
        else:
            s = m - bisect_left(B, x)
            t = n - bisect_left(A, x)
            res *= s * t - (n * m - x)
        res %= mod
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 68648
//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

fn main() {
    input! {
        n: usize,
        h: [u64;n],
    }

    let ans = if n == 1 {
        true
    } else {
        h.iter()
            .skip(1)
            .fold((h[0], true), |(prev, flag), now| {
                if flag {
                    if prev <= *now {
                        return (*now, flag);
                    } else if prev <= now + 1 {
                        return (now + 1, flag);
                    }
                }
                (prev, false)
            })
            .1
    };

    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352