akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long ll;
typedef std::pair<ll,ll> P;

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

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

constexpr ll mod = 1e9 + 7;

struct UnionFind {
public:
	vector <ll> par; // 
	vector <ll> siz; // 

	UnionFind() {}

	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}

	ll root(ll x) {
		while (par[x] != x) {
			x = par[x] = par[par[x]];
		}
		return x;
	}

	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}

	bool issame(ll x, ll y) {
		return root(x) == root(y);
	}

	ll size(ll x) {
		return siz[root(x)];
	}
};

int main() {
	int h, w;
    cin >> h >> w;
    vector<string> vs(h);
    rep(i, h) {
        cin >> vs[i];
    }
	vector<vector<ll>> dp(h, vector<ll>(w, 1e15));
	if (vs[0][0] == '#') dp[0][0] = 1;
	else dp[0][0] = 0;	

	P shifts[] = { {1,0},{0,1}};
	rep(i, h) {
		rep(j, w) {
			for (auto s : shifts) {
				auto nx = j + s.first;
				auto ny = i + s.second;
				if (nx >= 0 && nx < w) {
					if (ny >= 0 && ny < h) {
						if (vs[i][j] == '.' && vs[ny][nx] == '#') {
							chmin(dp[ny][nx], dp[i][j] + 1);
						}
						else{
							chmin(dp[ny][nx], dp[i][j]);
						}
					}
				}
			}
		}
	}
	cout << dp[h - 1][w - 1] << endl;
	return 0;
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+20;
int a[N];
int main()
{
	int n;
	while(cin>>n)
	{
		int cnt=0;
		for(int i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
			if(a[i]%2)
			cnt++;	
		}
		if(cnt%2)
		puts("NO");
		else
		puts("YES");
		
	}
	return 0;	
} 

Measured memory_bytes: 1148
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll k;
    cin >> k;
    vector<ll> z(50, 49 + k / 50);
    for (int i = 0; i < k%50; i++) {
        z[i] += 51-k%50;
    }
    for (int i = k % 50; i < 50; i++) {
        z[i] -= k%50;
    }
    cout << 50 << endl;
    for (int i = 0; i < 50; i++) {
        cout << z[i];
        if (i != 49)cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3564
N=int(input())
A = []
for n in range(N):
    A.append(int(input()))
import numpy as np
A_np = np.array(A)
A_max = A_np.max()
A_max_idx = A_np.argmax()
A_np_next = np.delete(A_np, A_max_idx)
A_next_max = A_np_next.max()
if A_max == A_next_max:
    for n in range(N):
        print(A_max)
else:
    for n in range(N):
        if n == A_max_idx:
            print(A_next_max)
        else:
            print(A_max)

Measured memory_bytes: 26044
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
typedef long long ll;

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

int main()
{
        int W, H, N;
        cin >> W >> H >> N;
        int xmi = 0, ymi = 0, xma = W, yma = H;

        rep(i, N)
        {
                int x, y, a;
                cin >> x >> y >> a;
                if (a == 1)
                {
                        xmi = max(xmi, x);
                }
                else if (a == 2)
                {
                        xma = min(xma, x);
                }
                else if (a == 3)
                {
                        ymi = max(ymi, y);
                }
                else
                {
                        yma = min(yma, y);
                }
        }
        int ans = 0;
        if (xmi < xma && ymi < yma)
        {
                ans = (xma - xmi) * (yma - ymi);
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
// D - Maze Master
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
using vi = vector<int>;
using vvi = vector<vi>;

// BFS (幅優先探索)
// 文字列迷路Sについて、S[sh][sw]から各マスまでの最短コストをdist[h][w]に求める
#define HMAX 20
#define WMAX 20
#define INF 100000
vvi dist(HMAX+2, vi(WMAX+2, INF));//外周を壁で囲む (-1:未訪問, 0~<INF:訪問済&コスト, INF:壁)
void bfs(int sh, int sw){
	int dx[4]={0,-1,0,1}, dy[4]={-1,0,1,0};
	dist[sh][sw] = 0;//最短コスト
	queue<int> qh, qw;
	qh.push(sh), qw.push(sw);
	while(!qh.empty()){
		int ph = qh.front(), pw = qw.front();
		qh.pop(), qw.pop();
		rp(k, 0, 4){//四方向
			int h = ph + dy[k], w = pw + dx[k];
			if(dist[h][w] > -1) continue;//壁・訪問済み
			dist[h][w] = dist[ph][pw] + 1;//最短コスト
			qh.push(h), qw.push(w);
		}
	}
}

int main(){
	int H,W; cin>>H>>W;
	rp(h, 1, H+1){
		string s; cin>>s;
		rp(w, 1, W+1) if(s[w-1]=='.') dist[h][w] = -1;//未訪問
	}

	int ans = 0;
	vvi dist_temp = dist;
	rp(h, 1, H+1){
		rp(w, 1, W+1){
			if(dist_temp[h][w]<0){
				dist = dist_temp;
				bfs(h,w);
				for(vi v:dist)for(int d:v) ans = max(ans, d==INF?-1:d);//壁は未訪問とみなす
			}
		}
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(void)
 
{
 
int a,b,d,r;
 
double f;
 
scanf("%d",&a);
 
scanf("%d",&b);
 
d=a/b;
 
r=a%b;
 
f=(double)a/(double)b;
 
printf("%d %d %lf\n",d,r,f);
 
return 0;
 
}
 

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

using namespace std;

const int N = 200000 + 7;

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

  int pos = 0;
  int cntb = 0; //black
  int cntw = 0; //white
  int hitb[N];
  int hitw[N];
  memset(hitb, 0, sizeof hitb);
  memset(hitw, 0, sizeof hitw);
  while(pos < n) {
    hitb[pos + 1] = hitb[pos];
    hitw[pos + 1] = hitw[pos];
    if(s[pos] == '#') {
      hitb[pos + 1]++;
      ++cntb;
    } else {
      hitw[pos + 1]++;
      ++cntw;
    }
    ++pos;
  }

  int ans = min(cntb, cntw);

  for(int i = 1; i <= n; ++i) {
    int l = hitb[i];
    int r = hitw[n] - hitw[i];
    ans = min(ans, l + r);
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 2180
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

ll f(ll n) {
  ll res = 0;
  while (n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}

double g(ll n) {
  return (double)(n)/f(n);
}

int main(){
    ll K;
    cin>>K;
    vector<ll> num;

    ll N=1;
    REP(i,15){
        REP2(j,1,150){
            num.push_back(N*(j+1)-1);
        }
        N*=10;
    }

    sort(num.begin(),num.end());
    num.erase(unique(num.begin(),num.end()),num.end());

    REP(i,num.size()){
        REP2(j,i+1,num.size()){
            if(g(num[i])>g(num[j])){
                num.erase(num.begin() + i--);
                break;
            }
        }
    }
    REP(i,K){
        cout<<num[i]<<endl;
    }


}

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

const int MAX = 10000000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
    long long X, Y;
    scanf("%lld%lld",&X,&Y);
    if((X+Y)%3!=0){printf("0\n");return 0;}
    long long n=(2*Y-X)/3;
    long long m=(2*X-Y)/3;
    if(n<0||m<0){printf("0\n");return 0;}
    long long nm=n+m;
    COMinit();
    cout << COM(nm,n) << endl;
    return 0;
}

Measured memory_bytes: 234624
//Belief yourself,Respect yourself

#include<bits/stdc++.h>
using namespace std;
#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search;
#define lower(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Lower value search;
#define max3(a,b,c) max(max(a,b),c)//maximum value find three value;
#define min3(a,b,c) min(min(a,b),c)//minimum value find three value;
#define rep(i,intial,n) for(int i=intial; i<(n) ; i++)
#define REP(i,intial,n) for(int i=intial; i<=(n) ; i++)
#define PI acos(-1.0)//PI Calculation
#define LL long long
#define MP make_pair
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define MX 1000005
#define MOD 1000000007

//Bit Operation
bool checkBit(LL n, int i) { return n&(1LL<<i); }  //AND
LL setBit(LL n, int i) { return n|(1LL<<i);; }     //OR
LL resetBit(LL n, int i) { return n&(~(1LL<<i)); } //OFF

template<typename T> T POW(T b,T p)          //Pow calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b);
        b=(b*b);
        p>>=1;
    }
    return r;
}

LL big_mod(LL n, LL p)
{
    if(p==0) return 1;
    if(!(p&1))
    {
        LL r = big_mod(n,p/2) % MOD;
        return ( (r%MOD) * (r%MOD) ) % MOD;
    }
    else return ( ( n%MOD) * (big_mod(n,p-1) %MOD)) % MOD;
}

long long gcd(long long a, long long b) {
  while (b != 0) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return a;
}

//||--------------------------->||Main_Code_Start_From_Here||<---------------------------------||
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
   int n,ar[100010],br[100010];
   while(cin>>n)
   {
       int cnt=0;
       rep(i,1,n+1) cin>>ar[i];
       br[1]=ar[1];
       rep(i,1,n+1)
       {
           if(br[i]==i && (ar[i+1]==(i+1)))
           {
               cnt++;
               br[i+1]=br[i];
           }
           else if(br[i]==i && (ar[i+1]!=(i+1)))
           {
               cnt++;
               br[i+1]=br[i];
           }
           else br[i+1]=ar[i+1];
       }
       //if(cnt%2==0) cout<<cnt/2<<endl;
       //else cout<<cnt/2+1<<endl;
       cout<<cnt<<endl;
   }

}



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

int main() {
  string s;
  set<char> c;
  int count=0;
  bool result=true;
  cin>>s;
  
  
  for(int i=0;i<s.size();i++){
    c.insert(s.at(i));
  }
  
  for(auto x:c){
    for(char y:s){
      if(x==y) count++;
    }
    if(count%2!=0){
      cout<<"No"<<endl;
      result=false;
      break;
    }
  }
  
  if(result)cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int maxn = 10;

int n, m, ans;
bool vis[3];

vector<int> targets, l;
vector<vector<int> > f;

int plan[3];

void dfs(int idx) {
	if (idx == n) {
		int sum = 0;
		for (int i = 0; i < m; ++i) {
			if (plan[i] == 0)
				return;
			sum += f[i][plan[i]];
		}

		ans = min(ans, sum);
		return;
	}

	dfs(idx+1);

	for (int i = 0; i < m; ++i) {
		plan[i] |= (1<<idx);
		dfs(idx+1);
		plan[i] -= (1<<idx);
	}
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n;

	int t[3];
	for (int i = 0; i < 3; ++i)
		cin >> t[i];

	for (int i = 0; i < n; ++i) {
		int tmp;
		cin >> tmp;
		for (int j= 0; j < 3; ++j)
			if (!vis[j] && t[j] == tmp) {
				vis[j] = true;
				tmp = -1;
				break;
			}

		if (tmp != -1)
			l.push_back(tmp);
	}

	for (int i = 0; i < 3; ++i)
		if (!vis[i])
			targets.push_back(t[i]);

	n = l.size(); //
	m = targets.size();
	int tot = (1<<n);
	f = vector<vector<int> >(m, vector<int>(tot));

	for (int i = 0; i < m; ++i)
		for (int j = 1; j < tot; ++j) {
			int sum = 0, cnt = 0;
			for (int k = 0; k < n; ++k)
				if (j & (1<<k)) {
					sum += l[k];
					++cnt;
				}

			f[i][j] = abs(targets[i] - sum) + 10 * (cnt-1);
		}

	ans = INT_MAX;
	dfs(0);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

ll dp[3010][3010][5];
ll tbl[3010][3010];

void init() {
    rep(i, 0, 3010) rep(j, 0, 3010) {
        rep(k, 0, 5) dp[i][j][k] = 0;
        tbl[i][j] = 0;
    }
}


int main(){

    init();

    // input
    ll R, C, K;
    cin >> R >> C >> K;
    VL r(K), c(K), v(K);
    rep(i, 0, K){
        cin >> r[i] >> c[i] >> v[i];
        tbl[r[i]-1][c[i]-1] = v[i];
    }

    // dp[i][j] := pair<ll, set<ll>>
    rep(i, 0, R+1){
        rep(j, 0, C+1) {
            // (i, j) -> (i+1, j)
            if(i < R){
                // i, j で取らない
                rep(k, 0, 4) dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][k]);
                // i, j で取る
                rep(k, 0, 3) dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][k] + tbl[i][j]);
            }
            // (i, j) -> (i, j+1)
            if(j < C){
                // i, jで取らない
                rep(k, 0, 4) dp[i][j+1][k] = max(dp[i][j+1][k], dp[i][j][k]);
                // i, jで取る 
                rep(k, 0, 3) dp[i][j+1][k+1] = max(dp[i][j+1][k+1], dp[i][j][k] + tbl[i][j]);
            }
        }
    }
    
    ll ans = 0;
    rep(i, 0, 4) ans = max(dp[R][C][i], ans);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 432676
#include<iostream>
using namespace std;
int main(){
    int K,N,ma=0;
    cin>>K>>N;
    int A[N]={0};
    for(int i=0;i<N;i++)cin>>A[i];
    for(int i=1;i<N;i++)ma=max(ma,A[i]-A[i-1]);
    cout<<K-max(ma,K-A[N-1]+A[0])<<endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int res = 0;

		if((1 <= A && 9 >= A) && (1 <= B && 9 >= B))
		{
			res = A * B;
			System.out.println(res);
		}
		else
		{
			res = -1;
			System.out.println(res);
		}
	}
}

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

int main() {
  int N, K, x, sum = 0;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> x;
    if (x > K - x) {
      sum += 2 * (K - x);
    }
    else {
      sum += 2 * x;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        ArrayList<ArrayList<Integer>> arr = new ArrayList<>();
        for (int i = 0; i < m; ++i) arr.add(new ArrayList<>());

        for (int i = 0; i < m; ++i) {
            int k = sc.nextInt();
            for (int j = 0; j < k; ++j) {
                int a = sc.nextInt();
                arr.get(i).add(--a);
            }
        }

        ArrayList<Integer> p = new ArrayList<>();
        for (int i = 0; i < m; ++i) p.add(sc.nextInt());

        long res = 0;
        for (int bit = 0; bit < (1<<n); ++bit) {
            boolean ok = true;
            for (int i = 0; i < m; ++i) {
                int con = 0;
                for (Integer val : arr.get(i)) {
                    if ((bit & (1<<val)) != 0) ++con;
                }
                if (con % 2 != p.get(i)) ok = false;
            }
            if (ok) ++res;
        }
        System.out.println(res);
    }
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

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

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// テーブルを作る前処理
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll N,K;
    cin >> N >> K;

    ll ans = 0;
    if(K==0){
        ans = N * N;
    } else { 
        rep(i,K+1,N+1) {
            ans += (i-K)*(N/i);
            ans += max(0LL,N%i-K+1);
        }
    }

    pl(ans)

    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll A, B;
    cin >> A >> B;
    if(A>=13) cout<<B<<endl;
    else if(A>=6) cout<<B/2<<endl;
    else cout<<0<<endl;

    return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if (a*b%2 == 0 ){
  cout<<"Even"<<endl;
  }
  else if (a*b%2!=0 ){
  cout<<"Odd"<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) (((a%MOD+MOD)%MOD+(b%MOD+MOD)%MOD)%MOD)
#define SUB(a, b) (((a%MOD+MOD)%MOD-(b%MOD+MOD)%MOD+MOD)%MOD)
#define MUL(a, b) ((((a%MOD+MOD)%MOD)*((b%MOD+MOD)%MOD))%MOD)
#define CHADD(a, b) (a = ADD(a, b))
#define CHMUL(a, b) (a = MUL(a, b))
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) (x/gcd(x,y)*y)
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b){ if(a<b){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b){ if(a>b){ a=b; return true; } return false; }
template<typename I> int ACC(I f, I l, int i = 0){ return accumulate(f, l, i); }


int N, M, P;
VPII g[2][2510];
bool u[2][2510];
bool t[2][2510];
VTIII e;
VI d;


bool bellmanFord(const VTIII& e, VI& d){
    fill(ALL(d), INF);
    d[0] = 0;
    rep(i, 0, SZ(d)) rep(j, 0, SZ(e)){
        int f = get<0>(e[j]);
        int t = get<1>(e[j]);
        int c = get<2>(e[j]);
        if(d[f] != INF && chmin(d[t], d[f]+c) && i == SZ(d)-1) return true;
    }
    return false;
}


void dfs(int v = 0, int n = N-1, bool inv = false){
    if(t[inv][v]) return;
    t[inv][v] = true;
    u[inv][v] = true;
    rep(i, 0, SZ(g[inv][v])) dfs(g[inv][v][i].first, n, inv);
}


signed main(){
    cin >> N >> M >> P;
    rep(i, 0, M){
        int A, B, C;
        cin >> A >> B >> C;
        g[0][A-1].pb({ B-1, P-C });
        g[1][B-1].pb({ A-1, 0 });
    }

    dfs();
    dfs(N-1, 0, true);

    rep(i, 0, N){
        if(!u[0][i] || !u[1][i]) continue;
        rep(j, 0, SZ(g[0][i])) e.pb(make_tuple(i, g[0][i][j].first, g[0][i][j].second));
    }

    d = VI(N);

    if(!bellmanFord(e, d)) cout << max(-d[N-1], 0LL) << endl;
    else cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // scanner
        Scanner sc = new Scanner(System.in);

        // ロード
        int N = Integer.parseInt(sc.next());

        // 処理・出力
        int[] mod2Cand = { 64, 32, 16, 8, 4, 2, 1 };
        for (int i = 0; i < mod2Cand.length; i++) {
            if (N >= mod2Cand[i]) {
                System.out.println(mod2Cand[i]);
                sc.close();
                return;
            }
        }

        // scanner
        sc.close();
    }
}

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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define MOD 1000000007
const double PI=3.14159265358979323846;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> T Ceil(T a, T b){return (a+b-1)/b;}

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

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }

int main() {
    cout<<fixed<<setprecision(10);

    ll n,m; cin>>n>>m;

    vint h(n); rep(i,n) cin>>h[i];

    vint maxval(n,0);

    rep(i,m){
        ll a,b; cin>>a>>b;
        a--; b--;
        chmax(maxval[a], h[b]);
        chmax(maxval[b], h[a]);
    }

    ll ans = 0;
    rep(i,n){
        if(h[i] > maxval[i]) ans++;
    }
    cout<<ans<<endl;


    return 0;

}

Measured memory_bytes: 4844
#include <iostream>

using namespace std;

int main()
{
	long long N;
	cin >> N;
	long long ans = 1;
	long long *A = new long long[N];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (A[i] == 0) {
			ans = 0;
		}
	}
	if (ans == 0) {
		cout << ans << endl;
		return 0;
	}

	for (int i = 0; i < N; i++) {
		if (A[i] <= 1000000000000000000 / ans) {
			ans *= A[i];
		}
		else {
			ans = -1;
			break;
		}
	}
	cout << ans << endl;

	delete A;
	return 0;
}

Measured memory_bytes: 4332
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

x = ni()
for i in range(-1*10**3, 10**3+1):
    for j in range(-1*10**3,10**3+1):
        pres = i**5 - j**5 == x
        if pres:
            print(i,j)
            sys.exit(0)

Measured memory_bytes: 9204
#include<bits/stdc++.h>
#include<bitset>
#include<random>
#include<time.h>

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1010;
const ll INF = 1LL << 60;

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



// Main Code
int main()
{
  string a, b;
  cin>>a>>b;
  string s = a + b;
  ll x = stoi(s);
  
  rep(i ,1, x)
  {
    if(i*i == x) {cout<<"Yes"<<endl; return 0;}
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a, b, c, r=0;
    cin >> a >> b >> c;
    for (int i = a;i<=b;i++) {
        if (c%i==0) {
            r++;
        }
    }
    cout << r << endl;
}



Measured memory_bytes: 3112
def make_divisors(n):
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            yield i
            if i != n // i:
                yield n // i


N, K = map(int, input().split())
A = tuple(map(int, input().split()))

divisors = list(make_divisors(sum(A)))
divisors.sort(reverse=True)

for divisor in divisors:
    M = [a % divisor for a in A]
    M.sort(reverse=True)
    # divisorで割った余が大きい方に貪欲に+1していく
    if sum(M[sum(M) // divisor:]) <= K:
        print(divisor)
        exit()


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

int main() {
  string s, t;
  cin >> s >> t;

  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());

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

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

int main () {
  int N,M;
  cin >> N >> M;
  
  vector<int>x(M);
  vector<int>y(M);
  vector<int>a(N,1);
  vector<int>b(N,0);
  b.at(0) = 1;
  for (int i = 0; i < M; i++) {
    cin >> x.at(i) >> y.at(i);
    if (b.at(x.at(i)-1) == 1){
      if (a.at(x.at(i)-1) == 1){
        b.at(x.at(i)-1) = 0;
      }
      b.at(y.at(i)-1) = 1;
    }
    a.at(x.at(i)-1)--;
    a.at(y.at(i)-1)++;
  }
  
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (b.at(i) == 1){
      count++;
    }
  }
  cout << count << endl;
}
  
  
    

Measured memory_bytes: 4716
def main():
    n,m = [int(v) for v in input().split()]
    if m==0:
        print(1)
        return
    
    g = [set() for _ in range(n+1)]
    seen = [False] * (n+1)
    for _ in range(m):
        a,b = [int(v) for v in input().split()]
        g[a].add(b)
        g[b].add(a)

    ans = 0
    for i in range(1,n+1):
        if seen[i]: continue
        stack = set([i])
        l = 0
        while len(stack)>0:
            no = stack.pop()
            seen[no] = True
            l += 1
            for nn in g[no]:
                if not seen[nn]:
                    stack.add(nn)
        ans = max(ans, l)

    # print(groups, g)
    print(ans)

main()

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

#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

typedef long long ll;

int main(){
  ll a,b,c,k; cin >> a >> b >> c >> k;
  ll ans = min(a, k);
  k -=  min(a, k);
  k -= min(b, k);
  ans -= min(c, k);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>

int main(void){
    // Your code here!
    int seikaisu[100000] = {}, N, K, Q, A;
    
    scanf("%d %d %d",&N, &K, &Q);
    
    for(int i = 0; i < Q; i++)
    {
        scanf("%d",&A);
        seikaisu[A-1]++;
    }
    
    for(int i = 0; i < N; i++)
    {
        //printf("%d\n",seikaisu[i]);
        if(K - Q + seikaisu[i] > 0)
            printf("Yes\n");
        else
            printf("No\n");
    }
}


Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define INF 10000000000

ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s;

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

    cin >> n >> x;
    vector<ll> list(n);
    rep(i, n){
        cin >> list[i];
        cnt += list[i];
    }
    if(cnt == x){
        cout << n << endl;
        return 0;
    }
    sort(all(list));
    ll sum = 0;
    rep(i, n){
        sum += list[i];
        if(sum > x){
            cout << i << endl;
            return 0;
        }
    }
    cout << n - 1 << endl;
}



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

int main(){
    int n; cin >> n;
    if(n % 10 == 9 || n / 10 == 9){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include<string>
using namespace std;
 
int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B && A == C && B == C) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;

namespace AtCoder
{
    class Program
    {
        private static readonly int DIV = (int)Math.Pow(10, 9) + 7;

        static void Main(string[] args)
        {
            // 整数の入力
            var traningCount = int.Parse(Console.ReadLine());
            long power = 1;
            for (var i = 2; i <= traningCount; ++i)
            {
                power *= i;
                if (power > DIV)
                {
                    power %= DIV;
                }
            }
            Console.WriteLine(power);
        }
    }
}


Measured memory_bytes: 13268
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<numeric>
#include<math.h>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    vector<ll> a(n*3);
    rep(i, n*3) cin >> a[i];
    sort(a.begin(), a.end());
    int r = a.size()-1;
    ll ans = 0;
    rep(i, n) {
        ans += a[r-1];
        r -= 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MP make_pair
#define PB push_back
typedef long long ll;

int N;
string s, t;

int main () {
        cin >> N >> s >> t;
        for (int o = N; o >= 0; o--) {
                if (s.substr(N-o, o) == t.substr(0, o)) {
                        return printf("%d\n", 2*N-o), 0;
                }
        }
        return 0;
}


Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val N = sc.nextInt
  val S = Array.fill(N+1)(sc.nextLine)

  println(s"AC x ${S.count(_ == "AC")}")
  println(s"WA x ${S.count(_ == "WA")}")
  println(s"TLE x ${S.count(_ == "TLE")}")
  println(s"RE x ${S.count(_ == "RE")}")
}


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

int main(void) {
  string s;
  cin >> s;
  
  int ptr_a = -1;
  int ptr_z;
  
  for (int i = 0; i < s.size(); ++i) {
    if ((ptr_a == -1) && (s[i] == 'A')) {
      ptr_a = i;
    }
    if (s[i] == 'Z') ptr_z = i;
  }
  int len = ptr_z - ptr_a + 1;
  cout << len << endl;
  
  return 0;
}

Measured memory_bytes: 640
n,x = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
y = []
if n == 1
    puts (x-a[0]).abs; exit
end
for i in 0..a.length-1
y << (x - a[i]).abs
end
m = []
for i in 0..y.length-2
    m << y[i].gcd(y[i+1])
end
puts m.min

Measured memory_bytes: 10116
#include<iostream>
#include<stdio.h>
#include<string.h>

using namespace std;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  //char c;
  //int n= int(s.size());

  int count = 0;
  for(int i=0;i<n-2;i++){
    string par = s.substr(i,3);
   
    string ans="ABC";
    if(par==ans){
      count += 1;
    }

  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	int X, Y;
	bool[,] map, flip, done;
	void Solve()
	{
		var I = G;
		Y = I[0]; X = I[1];
		map = new bool[X, Y];
		for (var y = 0; y < Y; y++)
		{
			var S = Str;
			for (var x = 0; x < X; x++) map[x, y] = S[x] == '#';
		}
		flip = new bool[X, Y];
		for (var x = 0; x < X; x++) for (var y = 0; y < Y; y++) flip[x, y] = map[x, y] ^ ((x + y) % 2 != 0);
		done = new bool[X, Y];
		var ans = 0L;
		for (var x = 0; x < X; x++) for (var y = 0; y < Y; y++) ans += Calc(x, y);
		WriteLine(ans);
	}
	int[] dx = { 1, 0, -1, 0, 1 };
	long Calc(int sx, int sy)
	{
		if (done[sx, sy]) return 0;
		var cnt = new int[2];
		var q = new Queue<Tuple<int, int>>();
		q.Enqueue(new Tuple<int, int>(sx, sy));
		var col = flip[sx, sy];
		while (q.Count > 0)
		{
			var p = q.Dequeue();
			if (done[p.Item1, p.Item2]) continue;
			cnt[map[p.Item1, p.Item2] ? 1 : 0]++;
			done[p.Item1, p.Item2] = true;
			for (var i = 0; i < 4; i++)
			{
				var x = p.Item1 + dx[i];
				var y = p.Item2 + dx[i + 1];
				if (x >= 0 && y >= 0 && x < X && y < Y && !done[x, y] && flip[x, y] == col) q.Enqueue(new Tuple<int, int>(x, y));
			}
		}
		return cnt[0] * (long)cnt[1];
	}
}


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

int main(){
  int n,m;
  cin>>n>>m;
  int vec[n];
  int ans[n];
  for(int i=0;i<n;i++){
    cin>>vec[i];
    ans[i]=1000;
  }
  int a,b;
  for(int i=0;i<m;i++){
    cin>>a>>b;
    if(vec[a-1]<=vec[b-1]){
      ans[a-1]--;
    }
    if(vec[b-1]<=vec[a-1]){
      ans[b-1]--;
    }
  }
  int z=0;
  for(int i=0;i<n;i++){
    if(ans[i]==1000){
      z++;
    }
  }
  cout<<z<<endl;
}

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

int main()
{
    int N; cin >> N;
    vector<ll> A(N); rep (i, N) cin >> A[i];
    vector<ll> B(N); rep (i, N) cin >> B[i];
    vector<ll> C(N); rep (i, N) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    vector<ll> sums(N+1);
    sums[0] = 0;
    rep (i, N)
    {
        ll b = B[i];
        auto c = upper_bound(C.begin(), C.end(), b);
        sums[i+1] = sums[i] + distance(c, C.end());
    }

    ll cnt = 0;
    rep (i, N)
    {
        ll a = A[i];
        auto b = upper_bound(B.begin(), B.end(), a);
        ll index = distance(B.begin(), b);
        cnt += sums[N] - sums[index];
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 6428
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 500 + 100;

int n, m;
char s[MAXN][MAXN];
bool red[MAXN][MAXN], blue[MAXN][MAXN];

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n >> m;
	for(int i = 1; i <= n; i++)
		cin >> (s[i] + 1);
	for(int i = 1; i <= n; i++)
		red[i][1] = true, blue[i][m] = true;
	for(int i = 1; i <= n; i++)
		for(int j = 2; j <= m - 1; j++)
			(i & 1 ? red : blue)[i][j] = true;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			if(s[i][j] == '#')
				red[i][j] = blue[i][j] = true;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= m; j++)
			cout << (red[i][j] ? '#' : '.');
		cout << endl;
	}
	cout << endl;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= m; j++)
			cout << (blue[i][j] ? '#' : '.');
		cout << endl;
	}


	return 0;
}


Measured memory_bytes: 1664
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():

    def fur(n,r):
        p,q = 1,1
        for i in range(r):
            p = p*(n-i)%mod
            q = q*(i+1)%mod
        return p * pow(q,mod-2,mod) % mod

    x, y = nm()

    if (x + y) % 3 != 0:
        print(0)
        exit()
    
    n = (2*y - x) // 3 # (X, Y) -> (X+1, Y+2) 
    m = (2*x - y) // 3 # (X, Y) -> (X+2, Y+1) 

    if n < 0 or m < 0:
        print(0)
        exit()

    print(fur(n+m, n))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3696
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
//#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i <= n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i <= n; i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std;

int main(void)
{
    int n, r;
    cin >> n >> r;

    if(n >= 10)  {
        cout << r << endl; 
    } else {
        cout << r + 100 * (10 - n) << endl;
    }

    return 0;
}
/** atcoder **/


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);


int main(){
  int K, S;
  cin >> K >> S;
  int cnt = 0;
  rep(i, K+1){
    rep(j, K+1){
      if(S - i - j <= K && S - i - j >= 0)
        cnt ++;
    }
  }
  cout << cnt << endl;
  
 }

Measured memory_bytes: 256
let () =
  let n = read_line () in
  print_endline @@
  if
    ( = ) 0 @@
    Fun.flip ( mod ) 9 @@
    Array.fold_left (fun acc c -> acc + Char.code c - Char.code '0') 0 @@
    Array.init (String.length n) (String.get n)
  then "Yes"
  else "No"


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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  ll x,y;
  cin>>x>>y;
  rep(i,1000)rep(j,1000){
    if(2*i+4*j==y&&i+j==x){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;

}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,c,m=0;
  string s,x,y;
  cin>>n>>s;
  for(int i=1;i<n;i++){
    c=0;
    x=s.substr(0,i);
    y=s.substr(i,n-i);
    set<char> se;
    for(int j=0;j<i;j++){
      se.insert(x.at(j));
    }
    for(char z : se){
      for(int j=0;j<n-i;j++){
        if(z==y.at(j)){
          c++;
          break;
        }
      }
    }
    m=max(m,c);
  }
  cout<<m;
}


Measured memory_bytes: 256
"use strict";
main(
  require("fs")
    .readFileSync("/dev/stdin", "UTF-8")
    .trim()
    .split("\n")
);

function main(input) {
  input[1] = input[1].split(" ");
  let result = new Set(input[1]);
  console.log(Array.from(result).length === parseInt(input[0]) ? "YES" : "NO");
}


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

int main()
{
    int arr[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    std::cin >> K ;
    std::cout << arr[K-1] << std::endl;
}


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

int main(){
    ll x; cin >> x;

    if(600 > x) put(8);
    else if(800 > x) put(7);
    else if(1000 > x) put(6);
    else if(1200 > x) put(5);
    else if(1400 > x) put(4);
    else if(1600 > x) put(3);
    else if(1800 > x) put(2);
    else put(1);
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <vector>
#include <queue>
#include <functional>

using lli = long long int;

int main(void){
    int Q; scanf("%d", &Q);
    lli B = 0, SL = 0, SU = 0;
    std::priority_queue<int> L;
    std::priority_queue<int, std::vector<int>, std::greater<int>> U;
    while(Q--){
        int k; scanf("%d", &k);
        if(k == 1){
            int a, b; scanf("%d%d", &a, &b); B += b;
            if(L.size() == U.size()){
                if(U.empty()){ L.push(a); SL += a; }
                else if(U.top() < a){
                    int v = U.top(); U.pop(); U.push(a); SU += a - v;
                    L.push(v); SL += v;
                }
                else{ L.push(a); SL += a; }
            }
            else{
                if(L.top() > a){
                    int v = L.top(); L.pop(); L.push(a); SL += a - v;
                    U.push(v); SU += v;
                }
                else{ U.push(a); SU += a; }
            }
        }
        else{
            if(L.empty()){ puts("0 0"); continue; }
            int arg = L.top();
            lli val = SU - SL + B; if(L.size() > U.size()) val += arg;
            printf("%d %lld\n", arg, val);
        }
    }
    return 0;
}

Measured memory_bytes: 3452