akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
int iso_lower(vector<int> V, int x) {
    //ソートされたVの中から、V[i]>=xとなる最小のiを返す.存在しなければVの要素数を返す
    int s = V.size();
    //V.push_back(INF);
    int l = -1;
    int r = s;  //rが常にtrue
    while(r - l > 1) {
        int mid = (l + r) / 2;
        if(V[mid] < x)
            l = mid;
        else
            r = mid;
    }
    return r;
}
signed main(){
    int N;cin>>N;
    int ans=0;
    for(int i=1;i<=N;i++){
        ans+=(N/i);
        if(N%i==0)ans--;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3668
import numpy as np

numlist = list(map(int,input().split()))
N = numlist[0]
K = numlist[1]

demelist = list(map(int,input().split()))
demearray = np.array(demelist)

exparray = (demearray+1)/2

Exp = 0
i = 0
while i < K:
    Exp = Exp + exparray[i]
    i = i + 1

Expmax = Exp

j = 1
while j < N-K+1:
    Exp = Exp - exparray[j-1] + exparray[K+j-1]
    if Exp > Expmax:
        Expmax = Exp
    j = j + 1

print(Expmax)

Measured memory_bytes: 33960
# coding: utf-8
# Your code here!
Q,H,S,D=map(int,input().split())
N=int(input())

n=N//2*2
ans=min(Q*4*n,H*2*n,S*n,D*n//2)

if N%2==1:
    ans+=min(Q*4,H*2,S)
    
print(ans)


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

int main(){
  int r,D,x_2000;

  cin >>r>>D>>x_2000;
  long long int x_n1 = x_2000;

  for(int i = 0;i<10;i++){
      long long int x_n = r*x_n1 - D;
      cout <<x_n<<endl;
      x_n1 = x_n;
  }
  return 0;
  }

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N=int(input())
a=[0]*N

max1=[0,0]
max2=[0,0]
for i in range(N):
    a=int(input())
    if max1[0]<=a:
        max2=max1
        max1=[a,i]
    elif max2[0]<=a:
        max2=[a,i]

for i in range(N):
    if i==max1[1]:
        print(max2[0])
    else:
        print(max1[0])

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


int cnt=1;
int main()
{
    ll a,b,g; cin>>a>>b;
    g=__gcd(a,b);

    for(int i=2;i<=sqrt(g);i++){
        if(g%i==0){
                cnt++;
            while(g%i==0) g/=i;
        }
    }
    if(g>1) cnt++;
    cout<<cnt;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 105
#define INF 1000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 100005;
const int MOD = 1000000007;
int main(){
    int d;
    cin>>d;
    d=abs(d-25);
    string s="Christmas";
    string t=" Eve";
    REP(i,d)s=s+t;
    OUT(s);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a;
	int b;
	int c;
	scanf("%d%d%d",&a,&b,&c);
	
	if (a < b  && b<c)
	{
		printf("Yes\n");
	}

	else
	{
		printf("No\n");
	}

	getchar();
	return 0;
}

Measured memory_bytes: 1012
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

const int INF = 1e9;

struct Edge {
    int from, to, cap, flow;
    Edge(int from, int to, int cap, int flow):from(from), to(to), cap(cap), flow(flow){}   
};

struct Maxflow {
    int n;
    vector<Edge> edges;
    vector<vector<int>> g;
    
    vector<int> p; //The id of the edge that connects to a vertex on the shortest path
    vector<int> a; //The possible flow change from the start to a vertex
    int flow = 0;
    
    Maxflow(int n) : n(n) {
        g.assign(n + 1, vector<int>());
    }
    
    void addEdge(int from, int to, int cap) {
        edges.push_back(Edge(from , to, cap, 0));
        edges.push_back(Edge(to, from, 0, 0));
        g[from].push_back(edges.size() - 2);
        g[to].push_back(edges.size() - 1);   
    }
    
    int solve(int s, int t) {
       while (findAugumentedPath(s, t)) {
       }
       return flow;
    }
    
    bool findAugumentedPath(int s, int t) {  
        p.assign(n + 1, -1);
        a.assign(n + 1, 0);
        
        queue<int> q;

        p[s] = -2;
        a[s] = INF;
        q.push(s);
        
        while (!q.empty()) {
            int u = q.front(); q.pop();
            for (int eid: g[u]) {
                Edge e = edges[eid];
                if (a[e.to] == 0 && e.cap > e.flow) {
                    p[e.to] = eid;
                    a[e.to] = min(a[u], e.cap - e.flow);
                    q.push(e.to);
                }
            }
            if (a[t] != 0) {
                break;
            }
        }
        if (a[t] == 0) {
            return false;
        }
        flow += a[t];
        for (int u = t; u != s; u = edges[p[u]].from) {
            edges[p[u]].flow += a[t];
            edges[p[u] ^ 1].flow -= a[t];
        }
        return true;
    }   
};

int main() {
    int v, e, s, t;
    //cin >> v >> e >> s >> t;
    cin >> v >> e;
    s = 0;
    t = v - 1;
    Maxflow maxflow(v);
    for (int i = 0; i < e; i++) {
        int from, to, cap;
        cin >> from >> to >> cap;
        maxflow.addEdge(from, to, cap);
    }
    int ans = maxflow.solve(s, t);
    cout << ans << endl;
    
    return 0;
}

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

int main() {
  int A, B; cin >> A >> B;
  double x1 = floor(A / 0.08);
  double x2 = ceil((A+1) / 0.08);
  double y1 = floor(B / 0.1);
  double y2 = ceil((B+1) / 0.1);
  double x = max(x1, y1);
  double y = min(x2, y2);

  int ans{-1};
  for (double i{x}; i <= y; ++i) {
    if (static_cast<int>(i*0.08) == A &&
        static_cast<int>(i*0.1) == B) {
      ans = i;
      break;
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
//---------------------------------------------------------------------------------------------------
typedef pair<int,int> P;
long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

int main(void){
    // Your code here!
    int n,p; cin >> n >> p;
    vector<int> a(n);
    rep(i,n) cin >> a[i],a[i] %= 2;
    Sort(a);
    ll ans = 0;
    int k = COUNT(a,0);
    int l = COUNT(a,1);
    if (p == 1) {
        // rep(i,k+1){
        //     ans += combi(k,i);
        // }
        ans += pow(2,k);
        // if (k == 0) ans = 1;
        ll cnt = 0;
        rep(i,l+1) {
            if (i % 2 == 1) cnt += combi(l,i);
        }
        ans *= cnt;
    } else {
        // rep(i,k+1){
        //     ans += combi(k,i);
        // }
        ans += pow(2,k);
        // if (k == 0) ans = 1;
        ll cnt = 0;
        rep(i,l+1) {
            if (i % 2 == 0) cnt += combi(l,i);
        }
        ans *= cnt;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int N = scan.nextInt();
		long K = scan.nextLong();

		long[] A = new long[N];

		double left = 0.0;
		double right = 0.0;

		for (int i = 0; i < N; i++) {
			A[i] = scan.nextLong();
			if (A[i] > right) {
				right = A[i];
			}
		}

		//演算
		if (K != 0L) {
			while (right - left > 0.000001) {
				double mid = (left + right) / 2.0;

				long result = 0L;

				for (int i = 0; i < N; i++) {
					result += (long) Math.ceil(A[i] / mid) - 1L;
				}

				if (result > K) {
					left = mid;
				} else {
					right = mid;
				}
			}
		}

		//結果出力
		System.out.println((long) Math.ceil(right));
	}
}


Measured memory_bytes: 60964
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        int x = i;
        if(x%3 == 0) {
            cout << " " << i;
            continue;
        }
        while(x) {
            if(x%10 == 3) {
                cout << " " << i;
                break;
            }
            x /= 10;
        }
    }
    cout << endl;
}


Measured memory_bytes: 3120
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
long long int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
vector<P> tree[100010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll>> pqls;
priority_queue <P,vector<P>,greater<P>> pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
//↓,→,↑,←
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
} 

ll i,j,k,ii,jj;
ll n,m,num,sum;
ll ans;
ll a,b,c,d,e,f,g,h,w;
char s[500][500];
ll x[800005],y[800005],z[900005];
ll bit[500005];


ll bitsum(ll i){
	ll s = 0;
	while(i>0){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void bitadd(ll b,ll x){
	while(b <= n+1){
		bit[b] += x;
		b += b & -b;
	}
}

bool solve(ll a){
	//全区間の中で、a以上の要素が半分以上あるか？
	//ある→true,ない→false
	for(int i=0;i<n;i++){
		if(x[i]>=a){
			y[i]=1;
		}else{
			y[i]=-1;
		}
	}
	fill(bit,bit+2*n,0);
	z[0] = 0;
	for(i=1;i<=n;i++){
		z[i] = z[i-1] + y[i-1];
	}	
	for(i=0;i<=n;i++){
		y[i] = z[i];
	}
	sort(y,y+n+1);
	//pe(a);
	for(i=0;i<=n;i++){
		z[i] = lb(y,y+n+1,z[i]+1) - lb(y,y+n+1,-INF);
		//pe(z[i]);
	}
	
	num = 0;

	for(i=0;i<=n;i++){
		num += bitsum(z[i]);
		bitadd(z[i],1);
	}

	//p(num);
	//pe(a);p(num);
	return (num>=(1+(n*(n+1)/2))/2);
}



int main(){	
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x[i];
	}
	ll start=0,end=2000000000;
	ll mid;
	
	while(end-start>1){
		mid = (start+end)/2;
		if(solve(mid+1)){
			start = mid;
		}else if(!solve(mid)){
			end = mid;
		}else{
			break;
		}
	}
	for(a=-3;a<3;a++){
		if(solve(mid+a) && !solve(mid+a+1)){
			mid = mid + a;
			break;
		}
	}
	if(n==1)mid=x[0];
	for(k=0;k<100;k++){
		//pe(k);p(solve(k));
	}
	
	p(mid);

	return 0;
}

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

int N, ans[10004];

int main() {
	cin >> N;

	for (int x=1; x<=100; x++) for (int y=1; y<=100; y++) for (int z=1; z<=100; z++) {
		ans[min(10001, x*x + y*y + z*z + x*y + y*z + z*x)]++;
	}

	for (int i=1; i<=N; i++) cout << ans[i] << '\n';
}


Measured memory_bytes: 3656
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);

    int N,L;
    cin >> N >> L;
    vector<string> s;
    for(int i=0; i<N; i++){
        string tmp;
        cin >> tmp;
        s.push_back(tmp);
    }
    sort(s.begin(), s.end());
    for(int i=0; i<N; i++) cout << s[i];
    cout << endl;
    
    return 0;
}

/*
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);
    

    
    return 0;
}
*/

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main () {
	int h, n;
	cin >> h >> n; 
	long long total = 0;
	for(int i = 0; i < n; i++) {
		long long cur;
		cin >> cur;
		total += cur;
	}
	if(total >= h) {
		cout << "Yes" << "\n";
	}else {
		cout << "No" << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

int main() {
  constexpr int mod_target {2019};
  ull L, R;
  cin >> L >> R;
  if (R - L > 2019) {
    cout << '0' << '\n';
  } else {
    int minest {2019};
    int L_mod = L % mod_target;
    int LR_size = R - L; // <= 2019
    for (int i = 0;i < LR_size;++i) {
      for (int j = i+1;j <= LR_size;++j) {
        int tmp = ((L_mod+i)*(L_mod+j))%mod_target;
        mins(minest, tmp);
      }
    }
    cout << minest << '\n';
  }
}


Measured memory_bytes: 512
#include <stdio.h>
int main()
{
	int n,m,d,i,j,k,area=0;
	char square[101][101];
	scanf("%d%d%d",&n,&m,&d);
	for(i=0;i<n;i++){
		scanf("%s",square[i]);
	}
	//横
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			k=1;
			if(square[i][j]=='.'){
				while(square[i][j+k]=='.'){
					if(d-1==k){
						area++;
						break;
					}
					k++;
				}
			}
		}
	}
	//縦
	for(j=0;j<m;j++){
		for(i=0;i<n;i++){
			k=1;
			if(square[i][j]=='.'){
				while(square[i+k][j]=='.'){
					if(d-1==k){
						area++;
						break;
					}
					k++;
				}
			}
		}
	}
	printf("%d\n",area);
	
	return 0;
}



Measured memory_bytes: 1996
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <utility>
typedef long long ll;
typedef long double ld;


#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;
ll S[1000] = { 0 };
int N,M,Q;


struct Info {
	ll value, weight, date;
	string type, name;
	bool operator<(const struct Info &arg) const {

		if (value != arg.value) {

			return value < arg.value;
		}
		else if (weight != arg.weight) {

			return weight < arg.weight;
		}
		else if (type != arg.type) {

			return type < arg.type;

		}
		else if (date != arg.date) {

			return date < arg.date;
		}
		else {

			return name < arg.name;
		}
	}
};


int main() {
	cin >> N;
	Info info[100005];
	rep(i, N) {
		cin >> info[i].value >> info[i].weight >> info[i].type >> info[i].date >> info[i].name;
	}
	sort(info, info + N);
	rep(i, N) {
		cout << info[i].value<<" " << info[i].weight << " " << info[i].type << " " << info[i].date << " " << info[i].name <<endl;
	}
	return 0;
}





Measured memory_bytes: 17904
#include <stdio.h>
#include <math.h>

int main(){
	int len, rot, deg = 0;
	double rad, x = 0, y = 0;
	
	do {
	    scanf("%d,%d", &len, &rot);
	    
	    rad = deg * 3.141592 / 180.0;
	    
		x += len * sin(rad);
		y += len * cos(rad);
		
		deg += rot;
	} while(len != 0 || rot != 0);
	
	printf("%d\n%d\n", (int)x, (int)y);
	
	return 0;
}

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

typedef double ll;
typedef pair<int,int> pii;
typedef pair<pii,char> piic;

const int N = 1e5;
const int INF = 1e9;

int n;
piic li[N+5];
ll xM,xm,yM,ym;
ll maxkanan,maxkiri,maxatas,maxbawah;
ll minkanan,minkiri,minatas,minbawah;


int main(){
	scanf("%d",&n);
	xM = yM = -INF;
	xm = ym = INF;
	maxkanan = maxatas = maxbawah = maxkiri= -INF;
	minkiri = minbawah = minkanan = minatas = INF;
	for(int i=1;i<=n;i++){
		scanf("%d %d %c",&li[i].first.first,&li[i].first.second,&li[i].second);
		
		if(li[i].second == 'U') maxatas = max(maxatas,(ll)li[i].first.second);
		else if(li[i].second == 'D') maxbawah = max(maxbawah,(ll)li[i].first.second);
		else if(li[i].second == 'R') maxkanan = max(maxkanan,(ll)li[i].first.first);
		else maxkiri = max(maxkiri,(ll)li[i].first.first);
		
		if(li[i].second == 'U') minatas = min(minatas,(ll)li[i].first.second);
		else if(li[i].second == 'D') minbawah = min(minbawah,(ll)li[i].first.second);
		else if(li[i].second == 'R') minkanan = min(minkanan,(ll)li[i].first.first);
		else minkiri = min(minkiri,(ll)li[i].first.first);
		if(li[i].second == 'U' || li[i].second == 'D'){
			xM = max(xM , (ll)li[i].first.first);
			xm = min(xm , (ll)li[i].first.first);
		} else {
			yM = max(yM , (ll)li[i].first.second);
			ym = min(ym , (ll)li[i].first.second);
		}
	}
	ll ans = (ll)1e17;
	for(double i=0;i<=2e8;i+=0.5){
		ll xmax = max(xM , maxkanan + i);
		xmax = max(xmax, maxkiri - i);
		ll xmin = min(xm , minkanan + i);
		xmin = min(xmin, minkiri - i);
		
		ll ymax = max(yM , maxatas + i);
		ymax = max(ymax, maxbawah - i);
		ll ymin = min(ym , minatas + i);
		ymin = min(ymin, minbawah - i);
		
		ans = min(ans , (xmax - xmin) * (ymax - ymin));
	}
	printf("%.10lf\n",ans);
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <deque>
#include <algorithm>
using namespace std;
inline deque<int> cl() {
	size_t count{};
	cin >> count;
	deque<int> lst(count);
	for (size_t i = 0; i < count; ++i) {
		cin >> lst.at(i);
	}
	return lst;
}
int main() {
	auto a = cl();
	auto b = a;
	copy(a.begin(), a.end(), b.begin());
	sort(b.begin(), b.end());
	int r{};
	for (int i = 0; i < a.size(); ++i) {
		if (a.at(i) != b.at(i))
			++r;
	}
	cout<<((r>2)?"NO":"YES")<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;

#define REP(i, N) for(int (i) = 0; (i) < (N); i++)
#define MAX 1 << 20

int main(){
    int n, a, max_a = 0, min_a = 1000;
    scanf("%d", &n);
    REP(i, n){
        scanf("%d", &a);
        if(a >= max_a) max_a = a;
        if(a <= min_a) min_a = a;
    }
    printf("%d", max_a - min_a);
    return 0;
}

Measured memory_bytes: 128
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd); FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    unordered_map<int, int> um;
    for(int i = 0; i < n; ++i){
        int d; cin >> d;
        um[d]++;
    }
    int m; cin >> m;
    for(int i = 0; i < m; ++i){
        int t; cin >> t;
        if(um[t] == 0){
            cout << "NO" << '\n';
            return 0;
        }
        um[t]--;
    }
    cout << "YES" << '\n';
}


Measured memory_bytes: 8060
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;
map <int,int> mp;
vector<int> V;
list<int> L;
stack<int> S;
queue<int> Q;
deque<int> dq;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define EPS (1e-10)
static const int MAX=100000;
static const int NMAX=50;
static const int MMAX=50;
ll H,W;
ll ans=INFLL;

int main(){
    cin.tie(0);  ios::sync_with_stdio(false);
    
    cin>>H>>W;
    
    if(H%3==0||W%3==0){
        cout<<0<<"\n";
        return 0;
    }else{
        for(int k=0;k<2;k++){
            ans=min(ans,(H/3+1)*W-H/3*W); //割り切れない時必ず最大(H+1)/3,最小H/3
            swap(H,W);
        }
    }
    
    //次は縦＋横二分割
    
    for(int k=0;k<2;k++){
        for(int ha=1;ha<=H;ha++){
            ll a=ha*W;
            ll b=(H-ha)*(W/2);
            ll c=(H-ha)*((W+1)/2);
            ans=min(ans,max(a,max(b,c))-min(a,min(b,c)));
        }
        swap(H,W);
    }
    cout<<ans<<"\n";
    return 0;
}


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

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

  int a, b;
  cin >> a >> b;

  int diff = b - a;
  int ap_sum = diff * (diff + 1) / 2;
  cout << ap_sum - b << "\n";
}


Measured memory_bytes: 3576
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int S;
int X,Y,X2,Y2,X3,Y3;


signed main(){
	cin>>S;
	int nine=pow2(10,9);
	X2=nine,Y2=1;
	int Q=S/nine;
	int R=S%nine;
	if(Q==nine){
		cout<<0<<" "<<0<<" "<<nine<<" "<<1<<" "<<0<<" "<<Q<<endl;
	}
	else{
		cout<<0<<" "<<0<<" "<<nine<<" "<<1<<" "<<nine-R<<" "<<Q+1<<endl;
	}
	return 0;
}
/*
2S=X*Y2-X2*Y;
*/

Measured memory_bytes: 256
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    if a[0] >= 1200:
        print("ARC")
    else:
        print("ABC")

Measured memory_bytes: 3828
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;


int main()
{
    int A,B;
    char s[199];
    while(cin>>A>>B)
    {
        cin>>s;
        int len=strlen(s);
        int flag=1;
        if(s[A]!='-') flag=0;
        for(int i=0;i<len;i++){
            if(i==A) continue;
            if(s[i]=='-'){
                flag=0;
                break;
            }
        }
        if(flag)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int a[200010];
bool used[30];
int main(){
    int i,j,n;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> a[i];
    }
    long long ans = 0,r = 0;
    for(i=0;i<20;i++){
        used[i] = false;
    }
    for(i=0;i<n;i++){
        if(i!=0){
            for(j=0;j<20;j++){
                if((1<<j) & a[i-1]) used[j] = false;
            }
        }
        bool flag = false;
        while(r<n){
            for(j=0;j<20;j++){
                if((1<<j) & a[r]){
                    if(used[j]){
                        flag = true;
                        break;
                    }
                }
            }
            if(flag) break;
            for(j=0;j<20;j++){
                if((1<<j) & a[r]) used[j] = true;
            }
            r++;
        }
        ans += r - i;
    }
    cout << ans << endl;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> e(m);
  for (auto& x : e) {
    cin >> x.first >> x.second;
    x.first--;
    x.second--;
  }
  vector<int> par(n, -1);
  auto root = [&](int t) {
    if (par[t] < 0) return t;
    for (int i = t;; i = par[i])
      if (par[i] < 0) return par[t] = i;
  };
  vector<ll> ans;
  ll aa = (ll)n * (n - 1) / 2;
  ans.push_back(aa);
  for (int i = m; --i;) {
    int r1 = root(e[i].first), r2 = root(e[i].second), c1 = -par[r1],
        c2 = -par[r2];
    if (r1 != r2) {
      par[r1] -= c2;
      par[r2] = r1;
      aa -= (ll)c1 * c2;
    }
    ans.push_back(aa);
  }
  reverse(ans.begin(), ans.end());
  for (auto x : ans) cout << x << endl;
}


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



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

  int x;
  cin >> x;

  cout << 10 - x / 200 << '\n';

  




  
  return 0;
}

Measured memory_bytes: 3632
import sys
import math
cadena = list()
sub = list()
sub2 =list()
s  =""" Since <fontstyle="vertical−align:inherit;"><fontstyle="vertical−align:inherit;">1+2=3<⁄font><⁄font>, the output should be <fontstyle="vertical−align:inherit;"><fontstyle="vertical−align:inherit;">3<⁄font><⁄font>."""
salida = """<fontstyle="vertical−align:inherit;"><fontstyle="vertical−align:inherit;">3<⁄font><⁄font>."""

kl = salida.find(">3<")


x = s.split()
j = s.find("1+2=3")
l = s.find(">3<")
sub2.append(s[l+1])

sub.append(s[j:j+5])
c = sub[0]
from itertools import permutations

lines = sys.stdin.readlines()
for linea in lines:
    c = linea.split()
    c = list(map(str,c))


x1 = int(c[0])
x2 =int(c[2])

operador = c[1]

if operador == "+":
  op = x1+x2
if operador == "-":
  op = x1-x2
elif operador == "*":
  op = x1*x2
if operador == "/":
  op = x1/x2      
str(op)
operacion1 = s[j:j+2]
my_lst_str = ''.join(map(str, c)) 
operacion1 = s[j:j+3]
men = s.replace(operacion1, my_lst_str)
s = men
numero =s[j+4]
men1 = salida.replace(salida[74], str(op))
men = s.replace(numero, str(op))
print(op)


Measured memory_bytes: 3316
n,k=map(int,input().split())
k=min(k,n-1)
mod=10000*100000+7
def mpow(a,b,m=100000*10000+7):#returns a**b%m
  ret=1
  while b>0:
    if b&1:
      ret=(ret*a)%m
    a=(a*a)%m
    b>>=1
  return ret
fact=[1]*(n+1)
ifact=[1]*(n+1)
for i in range(2,n+1):
  fact[i]=(fact[i-1] *i)%mod
ifact[n]=mpow(fact[n],mod-2)
for i in range(n-1,1,-1):
  ifact[i]=((i+1)*ifact[i+1])%mod
def nCr(n,r):
  if r==0 or r==n:
    return 1
  val=(fact[n]*ifact[r])%mod
  return (val*ifact[n-r])%mod
ans=0
for h in range(k+1):
  ans=(ans+(nCr(n,h)*nCr(n-1,n-h-1))%mod)%mod
print(ans)


Measured memory_bytes: 18804
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define tr(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define endl "\n" 
#define int long long
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/
const int N=2e5+10;

ll poww(long long a, long long n, long long m)
{
        long long ans = 1;
        long long mul = a;
        while (n != 0)
        {
                if (n % 2)
                {
                        ans = (ans * mul) % m;
                }
                mul = (mul * mul) % m;
                n /= 2;
        }
        return ans;
}
/* 
Fermat's little theorem: 
1) (a/b)%mod= (a*(poww(b,mod-2,mod)))%mod iff a%b==0
2) (a^b)%mod= (a^(b%(mod-1)))%mod iff mod is prime
*/
const int SZ=3e5+100;
ll factorial[SZ];
ll iv[SZ];
void precompute()
{
	factorial[0]=1;
    iv[0]=1;
	for(int i=1;i<SZ;i++)
	{
		factorial[i]=(factorial[i-1]*i)%MOD;
	   iv[i]=poww(factorial[i],MOD-2,MOD);
    }
}
ll InverseEuler(ll n, ll m)
{
    return poww(n, m - 2, m);
}
ll C(ll n, ll r, ll m)
{

    return (factorial[n] * ((InverseEuler(factorial[r], m) * InverseEuler(factorial[n - r], m)) % m)) % m;
}
vector<int> v[N];
int32_t main()
{
	fastio();
	int n,x,y;
	cin>>n>>x>>y;
	precompute();
	for(int i=1;i<=n;i++)
	{
		int c,w;
		cin>>c>>w;
		v[c].push_back(w);
	}
	for(int i=1;i<=n;i++)
	{
		sort(v[i].begin(),v[i].end());
	}
	int ind=0;
	int mi=1e9+2;
	for(int i=1;i<=n;i++)
	{
		if(!v[i].empty() && v[i].front()<mi)
		{
			mi=v[i].front();
			ind=i;
		}
	}
	int mi2=1e9+2;
	for(int i=1;i<=n;i++)
	{
		if(i==ind || v[i].empty())continue;
		mi2=min(mi2,v[i].front());
	}
	int ans=1;
	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		if(v[i].empty())continue;
		if(v[i].front()+(i==ind?mi2:mi)>y)continue;
		int c=1;
		for(int j=1;j<v[i].size();j++)
		{
			if(v[i][j]+v[i].front()>x && v[i][j]+(i==ind?mi2:mi)>y)break;
			c++;
		}
		ans*=iv[c];ans%=MOD;
		cnt+=c;
	}
	ans*=factorial[cnt];
	ans%=MOD;
	cout<<ans<<endl;
}


Measured memory_bytes: 14208
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	string s;
	int K;
	cin >> s >> K;
	int i = 0;
	vector<int>v(s.size());
	rep(i, s.size())v[i] = ('z' - s[i] + 1) % 26;
	rep(i, s.size()) {
		if (K >= v[i]) {
			K -= v[i];
			s[i] = 'a';
		}
	}
	s[s.size() - 1] = s[s.size() - 1] + K % 26;
	rep(i, s.size())cout << s[i];
	cout << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
const ll MOD = 1000000007;

int main() {
	ll N, A, B;
	cin >> N >> A >> B;
	if (A * B < N) {
		cout << -1 << endl;
		return 0;
	}
	if (A + B - 1 > N) {
		cout << -1 << endl;
		return 0;
	}
	if (B == 1) {
		for (int i = 0;i < A;i++) {
			cout << i + 1 << " ";
		}
		cout << endl;
		return 0;
	}
	
	vector<int> X(N);
	for (int i = 0;i < N;i++) {
		X[i] = i + 1;
	}
	ll Y = (N - A) / (B - 1);
	ll Z = (N - A) % (B - 1);
	for (ll i = 0;i < Y;i++) {
		reverse(X.begin() + B * i, X.begin() + B * (i + 1));
	}
	reverse(X.begin() + B * Y, X.begin() + B * Y + Z + 1);
	for (int i = 0;i < N;i++) {
		cout << X[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 3328
let scan_line () = Scanf.scanf "%d %d\n" (fun a b -> (a, b))

let n = Scanf.scanf "%d\n" (fun x -> x)

let init n =
  let rec aux i ls =
    if i = 0 then List.fast_sort (fun i j -> fst i - fst j) ls
    else aux (i - 1) (scan_line () :: ls)
  in
  aux n []


let r' = init n
let b' = init n

let rec solve r count = function
  | [] -> count
  | bp :: l ->
    match List.filter (fun rp -> fst rp < fst bp && snd rp < snd bp) r with
    | [] -> solve r count l
    | r' ->
      let v = List.fast_sort (fun i j -> snd j - snd i) r' |> List.hd in
      solve (List.remove_assoc (fst v) r) (count + 1) l


let () = solve r' 0 b' |> Printf.printf "%d\n"

Measured memory_bytes: 640
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	sub := "ABC"
	n, s := readInt(), readString()

	ans := 0
	i := 0
	for i < n {
		j := strings.Index(s[i:], sub)
		if j == -1 {
			break
		}
		i += j + len(sub)
		ans++
	}

	fmt.Println(ans)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;


int main() {
	string s;
	int n, k;
	char t;
	cin >> n >> s >> k;
	t = s.at(k - 1);
	for (int i = 0; i < n; i++) {
		if (!(s.at(i) == t)) {
			s.at(i) = '*';
		}
	}
	cout << s << endl;
	
}



Measured memory_bytes: 256
bingo = []
for i in range(3):
    a,b,c = map(int, input().split())
    bingo.append([a,b,c])
N = int(input())
b = [int(input()) for i in range(N)]
for n in range(N):
    for i in range(3):
        for j in range(3):
            if b[n]==bingo[i][j]:
                bingo[i][j] = 0
if(bingo[0][0] == bingo[0][1] == bingo[0][2] or
   bingo[1][0] == bingo[1][1] == bingo[1][2] or
   bingo[2][0] == bingo[2][1] == bingo[2][2] or
   bingo[0][0] == bingo[1][0] == bingo[2][0] or
   bingo[0][1] == bingo[1][1] == bingo[2][1] or
   bingo[0][2] == bingo[1][2] == bingo[2][2] or
   bingo[0][0] == bingo[1][1] == bingo[2][2] or
   bingo[0][2] == bingo[1][1] == bingo[2][0]):
    print('Yes')
else:
    print('No')

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

#include <math.h>
#include <stdlib.h>


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

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

//INT_MAX	2,147,483,647 = 2*1.0e9

ll gcd_euclid(ll a, ll b){
    return b==0 ? a : gcd_euclid(b, a%b);
}


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll a, b; cin >> a >> b;

    ll gcd = gcd_euclid(a,b);
    int ans = 1;
    ll n = gcd;
    for(ll i = 2; i * i <= gcd; i++){
        if(n % i == 0) ans++;
        while(n % i == 0)n/=i;
    }
    if(n!=1) ans++;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int H,A;
	cin>>H>>A;
	int i,s=0;
	for(i=H;i>=0;i-=A){
		s++;
	}
	if(i==0-A){
		s--;
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

void input(int *p)
{
	int i;

	for (i = 0; i < 10; i++){
		scanf("%d", &p[i]);
	}
}

void swap(int *a, int *b)
{
	*a += *b;
	*b = *a - *b;
	*a -= *b;
}

void sort(int a[])
{
	int i, j;

	for (i = 0; i < 9; i++){
		for (j = i + 1; j < 10; j++){
			if (a[i] > a[j]){
				swap(&a[i], &a[j]);
			}
		}
	}
}

int add(int a[])
{
	int ans = 0;
	int i;

	for (i = 7; i < 10; i++){
		ans += a[i];
	}

	return (ans);
}

int main(void)
{
	int w[10];
	int k[10];
	int ans_w, ans_k;

	input(&w[0]);
	input(&k[0]);

	sort(&w[0]);
	sort(&k[0]);

	ans_w = add(&w[0]);
	ans_k = add(&k[0]);

	printf("%d %d\n", ans_w, ans_k);

	return (0);
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<LL> VI;
typedef vector<VI> VVI;
typedef pair<LL, LL> PII;
typedef vector<string> VS;
inline LL toInt(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x,c) for(auto x: (c))
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define STABLE_SORT(c) stable_sort(ALL(c))
#define STABLE_RSORT(c) stable_sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)), (c).end());
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define dump(x)  cerr << #x << " = " << (x) << endl;


int main() {
	LL H, W, h, w;
	cin >> H >> W;
	cin >> h >> w;

	cout << (H - h) * (W - w) << endl;
	
    return 0;
}


Measured memory_bytes: 256
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;
using ll = long long int;

int main(void){
    double L;cin>>L;
    L /= 3.0;
    cout << setprecision(18) << L*L*L << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

if __name__ == "__main__":
    n = int(input())
    lst = []
    count = 0
    words = defaultdict(lambda: 0)
    for i in range(n):
        words[''.join(sorted(input()))] += 1
    sum = 0
    for word in words:
        sum += int(words[word]*(words[word] - 1)/2)
    print(sum)


Measured memory_bytes: 18228
MOD = 998244353

n, k = map(int, input().split())
l = [0] * k
r = [0] * k
for i in range(k):
    l[i], r[i] = map(int, input().split())

s = [0] * (n + 2)
for i in range(k):
    for j in range(l[i], r[i] + 1):
        s[j] = 1

ans = [0] * (n + 1)
ans[0] = 1
for i in range(n - 1):
    ans[i + 1] = ans[i]
    for j in range(k):
        ans[i + 1] += ans[max(-1, i + 1 - l[j])]
        ans[i + 1] -= ans[max(-1, i + 1 - r[j] - 1)]
        ans[i + 1] = ans[i + 1] % MOD
print((ans[n - 1] - ans[n - 2]) % MOD)


Measured memory_bytes: 76800
#include <iostream>
#include <string>
#include <cstdio>
#include <map>
using namespace std;

int main() {
	int a[10] = { 1,3,5,7,8,1,10,12 }, b[10] = { 4,6,9,11 };
	
	int x, y;
	bool fl1 = 0, fl2 = 0, fl3 = 0, fl4=0;
	cin >> x >> y;
	for (int i = 0; i < 7; i++) {
		if (a[i] == x)fl1 = 1;
		if (a[i] == y)fl2 = 1;
	}
	for (int i = 0; i < 4; i++) {
		if (b[i] == x)fl3 = 1;
		if (b[i] == y)fl4 = 1;
	}
	if ((fl1 == 1 && fl2 == 1) || (fl3 == 1 && fl4 == 1)) { cout << "Yes\n"; }
	else {
		cout << "No\n";
	}

	return 0;
}

Measured memory_bytes: 256
// f 题
// 100101010 式序列中，sum(每个连续序列长度-1) 就是 happy 人数。
// 所以每次 reverse 最多能让 happy 人数 + 2
// 操作：找到一个不靠边界的连续序列，reverse。
// 如果找不到，就找到一个靠边界的连续序列，reverse。
// 直到次数用完/变成一个最大连续序列。
// （这种做法不会比任意一种做法差，所以是可取的）

// eg:
// LRRLRLRRLRLLR
// 1001010010110  #0, 3 man
// 1111010010110  #1, 5 man
// 1111110010110  #2, 7 man
// 1111111110110  #3, 9 man


#include <iostream>

using namespace std;

const int MAX_N =100000;
int S[MAX_N];

void print(int N){
    for (int i=0; i<N; i++) {
        cout << S[i] << ' ';
    }
    cout << endl;
}

int happy_num(int N) {
    int happy = 0;
    int len = 1;
    int current = S[0];
    for (int i=1; i<N; i++) {
        if (S[i] == current) {
            len++;
        } else {
            happy = happy + len - 1;
            len = 1;
            current = S[i];
        }
    }
    // caution the tail!
    happy = happy + len - 1;
    return happy;
}

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

    int K;
    cin >> K;

    char dir;
    for (int i=0; i<N; i++) {
        cin >> dir;
        if (dir == 'L') {
            S[i] = 1;
        } else {
            S[i] = 0;
        }
    }

    int happy = happy_num(N); // base
    int base = S[0];
    int op = 0; // time of  operation has been done 

    bool in_string = false;
    for (int i=1; i<N; i++) {
        if ( (in_string == false) && (S[i] != base)) {
            in_string = true;
        }
        if ( (in_string == true) && (S[i] == base) ) {
            in_string = false;
            happy = happy + 2;
            op++;
            if (op == K)
                break;
        }
    }

    if (in_string == true && op < K) {
        happy++;
    }

    cout << happy;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;
typedef struct{
    vector<int> num;
    int pos;
}POINT;
void process();
int main(){
    process();
}
void process(){
    int i,j;
    string s,t;
    string temp;
    LL loop;
    LL temp_pos;
    POINT point[26];
    cin >> s;
    cin >> t;
    temp = s;
    bool flag;
    int pos;

    //sort(temp.begin(),temp.end());
    auto itr = point[pos].num.begin();
    
    for(i=0;i<26;i++){
        point[i].pos = 0;
    }

    for(i=0;i<s.length();i++){
        point[s[i] - 'a'].num.push_back(i);
    }
    loop = 0;
    temp_pos = -1;
    
    
    for(i=0;i<t.length();){
        pos = t[i] - 'a';
        flag = false;
        if( point[pos].num.size() == 0 ){
            cout << -1 << endl;
            return;
        }
        itr = upper_bound(point[pos].num.begin(),point[pos].num.end(),temp_pos);
        for(j=0; j< point[pos].num.size() &&  point[pos].num[j] <= temp_pos ; j++);
        if( itr != point[pos].num.end()){
            temp_pos = *itr;
            i++;
        }else{
            temp_pos = -1;
            loop++;
        }
    }
    cout << s.length() * loop + temp_pos + 1 << endl;
    return;
}

Measured memory_bytes: 1152
use std::collections::BTreeMap;
use std::cmp::max;
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let n:usize = read();
    let mut map = BTreeMap::new();
    for _ in 0..n {
        let x:usize = read();
        *map.entry(x).or_insert(0) += 1;
    }
    let mut x = 0;
    let mut y = 0;
    let mut map = map.iter();
    loop {
        if x != 0 && y != 0 {
            break;
        }
        let i = map.next_back();
        if i.is_none() {
            break;
        }

        let (k, v) = i.unwrap();
        let k = *k;
        if v >= &4 {
            x = max(x, k);
            y = max(y, k);
        } else if v >= &2 {
            if x == 0 {
                x = max(x, k);
            } else {
                y = max(y, k);
            }
        }
    }
    println!("{}", x * y);
}


Measured memory_bytes: 4368
#include <bits/stdc++.h>
#define N 1000000007;

using namespace std;

int main()
{
 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 int n;
 cin>>n;
 string s[n];
 map<string,int>d;
 for(int i=0;i<n;i++)
 {
     string ch;
     cin>>ch;
     d[ch]++;
 }
 cout<<"AC x "<<d["AC"]<<endl;
 cout<<"WA x "<<d["WA"]<<endl;
 cout<<"TLE x "<<d["TLE"]<<endl;
 cout<<"RE x "<<d["RE"]<<endl;


}


Measured memory_bytes: 6752
/*
First, solve the problem.Then write the code. - John Johnson
@author: returnAC
*/
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define need_for_speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); // Thanks Joshua :)
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c)) 
typedef long long ll;
typedef unsigned long long llu;
const double PI = 2*acos(0.0);

signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	need_for_speed;
	int n,l;
	cin>>n>>l;
	int sum=0;
	int flav[n+1];
	for(int i=1;i<=n;i++)
		flav[i]=l+i-1,sum+=flav[i];
	int res = sum-flav[1];
	int dist = abs(sum-(sum-flav[1]));
	for(int i=2;i<=n;i++)
		if(abs(sum-(sum-flav[i]))<dist)
			dist=abs(sum-(sum-flav[i])),res=sum-flav[i];
	cout<<res<<endl;
}

Measured memory_bytes: 256