akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define int long long

#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##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(box) box.begin(), box.end()

using namespace std;

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

const long long INF = LLONG_MAX/3;

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; }

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[a]+=siz[b];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=1e9+7;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		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;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
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 cnt[35][200010]={};
signed main(){
	int n;
	cin>>n;
	int c;
	cin>>c;
	rep(i,n){
		int s,t,u;
		cin>>s>>t>>u;
		u--;
		cnt[u][s*2]++;
		cnt[u][t*2]--;
	}
	rep(i,c){
		rep(j,1,200010){
			cnt[i][j]=cnt[i][j-1]+cnt[i][j];
			if(cnt[i][j-1]+1==cnt[i][j])cnt[i][j-1]++;
		}
	}
	int ans[200010]={};
	rep(i,c){
		rep(j,200010){
			ans[j]+=cnt[i][j];
		}
	}
	int re=0;
	rep(i,200010){
		re=max(re,ans[i]);
	}
	cout<<re<<endl;
}

Measured memory_bytes: 48896
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

// g++ -std=c++11 prac.cpp
ll Max=-1e9,Min=1e9+1;
 
int main(){
    ll x,c,y=0,n,m,l,w,sum=0,sum2=0,ans=0;
    string t;
    bool f=true;
    cin >> n >> m;
    if(n >= m){
        cout << m/2 << endl;
        return 0;
    }
    else{
        ans += n;
        m -= n*2;
        ans += m/4;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int INF = 1001001001;

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; }

vector<vector<int>> dp(110,vector<int>(110, INF));

int f(char c) {
  if(c=='#') return 1;
  else return 0;
}


int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  REP(i, h) cin >> s[i];

  dp[0][0] = 0;
  if(s[0][0]=='#') dp[0][0]++;
  // REP(i, h)  {
  //   REP(j, w) {
  //     if(j!=w-1) chmin(dp[i][j+1],dp[i][j]+f(s[i][j+1]));
  //     if(i!=h-1) chmin(dp[i+1][j],dp[i][j]+f(s[i+1][j]));
  //   }
  // }
  FOR(i, 0, h)  {
    FOR(j, 0, w) {
      if(j) {
        int x = f(s[i][j]);
        if(s[i][j-1]=='#') x = 0;
        chmin(dp[i][j],dp[i][j-1]+x);
      }
      if(i) {
        int x = f(s[i][j]);
        if(s[i-1][j]=='#') x = 0;
        chmin(dp[i][j],dp[i-1][j]+x);
      }
    }
  }
  int ans = dp[h-1][w-1];
  // REP(i, h)  {
  //   REP(j, w) {
  //     printf("%d%c", dp[i][j], (j==w-1?'\n':' '));
  //   }
  // }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main(){
  string a;
  cin >> a;
  int b;
  cin >> b;
  string c = "";
  for(int i = 0 ; i < a.size(); i++){
    if(i%b == 0) c = c + a[i];
  }
  cout << c << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
    int matrix[100][100],i,j,input,n,m,matrix1[100],sum=0;
    scanf("%d %d",&n,&m);
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&matrix[i][j]);
        }
    }
    for(i=0;i<m;i++){
        scanf("%d",&matrix1[i]);
    }
    for(i=0;i<n;i++){
        sum=0;
        for(j=0;j<m;j++){
            sum+=matrix[i][j]*matrix1[j];
        }
        printf("%d\n",sum);
    }
    return 0;
}


Measured memory_bytes: 2112
#include <stdio.h>

int main()
{
    int n,x,t;
    scanf("%d %d %d",&n,&x,&t);
    if(n<x)
    {
        printf("%d",t);
    }
    else if(n%x==0)
    {
        t*=n/x;
        printf("%d",t);
    }
    else if(n%x!=0)
    {
    t*=((n/x)+1);
    printf("%d",t);
    }

    return 0;
}


Measured memory_bytes: 1728
#include<iostream>
#include<cmath>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;

int n;
long long c;
long long x[100011];
long long v[100011];

long long p[100011][3];
long long mp[100011][3];
long long q[100011][3];
long long mq[100011][3];

int main()
{
    int i,j,k;
    
    scanf("%d %lld",&n,&c);
    
    for(i=1;i<=n;i++)
    {
         scanf("%lld %lld",&x[i],&v[i]);
    }
    
    long long s=0;
    for(i=1;i<=n;i++)
    {
        s+=v[i];
        p[i][1]=s-x[i];
        p[i][2]=s-x[i]*2ll;
        
        mp[i][1]=max(mp[i-1][1],p[i][1]);
        mp[i][2]=max(mp[i-1][2],p[i][2]);
    }
    s=0;
    for(i=n;i>=1;i--)
    {
       s+=v[i];
       q[i][1]=s-(c-x[i]);
       q[i][2]=s-(c-x[i])*2ll;
       mq[i][1]=max(mq[i+1][1],q[i][1]);
       mq[i][2]=max(mq[i+1][2],q[i][2]);
    }
    
    long long ans=0;
    
    for(i=0;i<=n;i++)
    {
        //cout<<mp[i][1]<<' '<<mp[i][2]<<"   "<<mq[i][1]<<' '<<mq[i][2]<<endl;
        
        ans=max(ans,mp[i][1]+mq[i+1][2]);
        ans=max(ans,mp[i][2]+mq[i+1][1]);
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 11136
#include<fstream>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<unordered_map>
#include<ctime>
using namespace std;
const int DN=1e5+5;
const int M=1e9+7;
long long n,a[DN],dp[DN],fact[DN],rez,f;
int inv(int a,int b)
{
    int p=1,c=a,r=1;
    while(p<=b)
    {
        if(p&b)
            r=(1LL*r*c)%M;
        p=p*2;
        c=(1LL*c*c)%M;
    }
    return r;
}
int aranj(int n,int k)
{
    int rez;

    rez=(1LL*fact[n]*inv(fact[n-k],M-2))%M;
    //cout<<n<<' '<<n-k<<' '<<fact[n]<<' '<<fact[n-k]<<' '<<rez<<'\n';
    return rez;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    dp[1]=1;
    fact[0]=fact[1]=1;
    for(int i=2;i<=n;i++)
    {
        dp[i]=(1LL*dp[i-1]*i+fact[i-1])%M;
        fact[i]=(1LL*fact[i-1]*i)%M;
    }
   // cout<<dp[1]<<' '<<dp[2]<<' '<<(inv(3,M-2)*2)%M<<' '<<fact[n]<<'\n';
    for(int i=1;i<=n;i++)
    {
        f=(1LL*aranj(n,i-1)*dp[n-i+1])%M;
        rez=(rez+1LL*f*a[i])%M;
    }
    for(int i=n;i>0;i--)
    {
        f=(1LL*aranj(n,n-i)*dp[i])%M;
        rez=(rez+1LL*f*a[i])%M;
    }
    for(int i=1;i<=n;i++)
        rez=(rez+M-(1LL*fact[n]*a[i])%M)%M;
    cout<<rez;
}


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

int main(){
  int n,m; cin>>n>>m;
  vector<int>L(m);
  vector<int>R(m);
  rep(i,m) cin>>L[i]>>R[i];
  int max_L = L[0];
  int min_R = R[0];
  for (int i=1; i<m; i++){
    if (max_L < L[i]) max_L = L[i];
    if (min_R > R[i]) min_R = R[i];
  }
  int ans = min_R - max_L + 1;
  if (ans>0) cout << ans << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 3952
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,int> Pi;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<(n);i++)
#define Fr(i,n) for(int i=0;i++<(n);)
#define ifr(i,n) for(int i=(n)-1;i>=0;i--)
#define iFr(i,n) for(int i=(n);i>0;i--)

int main(){
  int n,m,p,q,c;
  cin>>n>>m;
  map<P,vector<Pi>> v;
  fr(i,m){
    cin>>p>>q>>c;
    v[mp(p,c)].pb(mp(mp(q,c),0));
    v[mp(q,c)].pb(mp(mp(p,c),0));
    v[mp(p,0)].pb(mp(mp(p,c),1));
    v[mp(p,c)].pb(mp(mp(p,0),0));
    v[mp(q,0)].pb(mp(mp(q,c),1));
    v[mp(q,c)].pb(mp(mp(q,0),0));
  }
  priority_queue<iP,vector<iP>,greater<iP>> pq;
  map<P,bool> vis;
  pq.push(mp(0,mp(1,0)));
  while(!pq.empty()){
    iP ip=pq.top();
    pq.pop();
    int cst=ip.ft;
    P p=ip.sd;
    if(p==mp(n,0)){cout<<cst<<endl;return 0;}
    if(vis[p]) continue;
    vis[p]=1;
    fr(i,v[p].size()){
      if(vis[v[p][i].ft]) continue;
      pq.push(mp(cst+v[p][i].sd,v[p][i].ft));
    }
  }
  cout<<-1<<endl;
}


Measured memory_bytes: 89268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    string S,T;
    cin >> S >> T;
    int s,t;
    s = S.length();
    t = T.length();
    bool ans = true;
    if( s +1 != t){
        ans = false;
    }
    else{
        for(int i = 0 ; i < s; i++){
            if(S.at(i) != T.at(i)) ans = false;
        }
    }
    if(ans){
        printf("Yes");
    }
    else{
        printf("No");
    }
    

}



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

int main(void) {

	long long N, M, K;
	cin >> N >> M >> K;
	vector<long long> A(N), B(M);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < M; i++) {
		cin >> B[i];
	}
	vector<long long> sumA(N + 1, 0);
	vector<long long> sumB(M + 1, 0);
	sumA[0] = 0;
	sumB[0] = 0;
	for (int i = 0; i < N; i++) {
		sumA[i + 1] = sumA[i] + A[i];
	}
	for (int i = 0; i < M; i++) {
		sumB[i + 1] = sumB[i] + B[i];
	}
	long long ans = 0, j = M;
	for (int i = 0; i < N + 1; i++) {
		if (sumA[i] > K) break;
		while (sumB[j] > K - sumA[i]) {
			j -= 1;
		}
		ans = max(ans, i + j);
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for(int i = 0; i < N; i++) cin >> A.at(i);
  int64_t mo = 1000;
  int64_t stk = 0;
  
  for(int i = 0; i < N; i++){
    if(stk != 0){
      mo += stk * A.at(i);
      stk = 0;
    }//売り
    
    if(i != N - 1){
      if(A.at(i) < A.at(i+1)){
        stk += (mo / A.at(i));
        mo %= A.at(i);
      }
    }
  }
  
  cout << mo << endl;
}

Measured memory_bytes: 3616
# Problem https://atcoder.jp/contests/abc087/tasks/abc087_b
# Python 1st Try


def solver(dataset):
    result = 0
    for yen500 in range(0, dataset[0]+1):
        for yen100 in range(0, dataset[1]+1):
            for yen050 in range(0, dataset[2]+1):
                sum = yen500*500+yen100*100+yen050*50
                if sum == dataset[3]:
                    result = result + 1
    return result


if __name__ == "__main__":
    datas = []
    for j in range(0, 4):
        datas.append(int(input()))
    print("{}".format(solver(datas)))


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

int main()
{
  	int h,w;
  
 	cin >> h >> w;
  
  	while(h != 0 || w != 0){
      for(int i = 0;i < h;i++){
     	 for(int j = 0;j < w;j++){
           if(i == 0 || i == h-1 || j == 0 || j == w-1)
             cout << '#';
           else
             cout << '.';
         }
        cout << endl;
      }
      cout << endl;
      
      cin >> h >> w;
    }
 	
    
}


Measured memory_bytes: 3004
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
int main(){
  int m,d,d1=0,d2=0,count=0;
  cin >> m >> d;
  r(i,m){
    r(j,d){
      d1=(j+1)/10;
      d2=(j+1)%10;
      if(d1>=2&&d2>=2&&(i+1)==d1*d2)count++;
    }
  }
  cout << count << endl;
}

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

int main() {
    int d, g;
    cin >> d >> g;
    vector<int> contests(d);
    vector<int> bonus(d);
    for (int i = 0; i < d; ++i) {
        cin >> contests[i] >> bonus[i];
    }
    ll ans = 1e9;
    for (int mask = 0; mask < 1 << d; ++mask) {
        int temp = mask;
        ll score = g;
        ll cnt = 0;
        int last;
        for (int i = 0; i < d; ++i) {
            if (temp & 1) {
                score -= (i + 1) * 100 * contests[i] + bonus[i];
                cnt += contests[i];
            } else {
                last = i;
            }
            temp >>= 1;
        }
        if (score <= 0) {
            ans = min(cnt, ans);
        } else {
            for (int j = 1; j < contests[last]; ++j) {
                if (j * (last + 1) * 100 >= score) {
                    cnt += j;
                    ans = min(cnt, ans);
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
o = [a[i] for i in range(0,n,2)]
e = [a[h] for h in range(1,n,2)]
if n%2 == 0:
    e.reverse()
    l = e + o
    print(*l)
else:
    o.reverse()
    l = o + e
    print(*l)

Measured memory_bytes: 30924
// D - String Equivalence
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	vector<string> s(1,"a");
	while(--N){
		vector<string>t; swap(s,t);
		rp(i, 0, t.size()){
			char mx='a'; rp(j, 1, t[i].size()) mx = max(mx, t[i][j]);
			rp(c, 'a', mx+2) s.push_back(t[i] + string(1,c));

		}
	}
	rp(i, 0, s.size()) cout<< s[i] <<endl;
}

Measured memory_bytes: 8780
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int gcd(int x,int y){
    if(y==0) return x;
    int z=x%y;
    x=y,y=z;
    return gcd(x,y);
}
int main(){
    int x,y;
    cin>>x>>y;
    cout<<gcd(x,y)<<endl;
    //cout<<__gcd(x,y)<<endl;
    return 0;
}


Measured memory_bytes: 3112
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <limits>
#include <ios>
#include <iomanip>
#include <stdio.h>
#include <iomanip>
#include <queue>
#include <set>
using namespace std;

#define rep(i,N) for(int (i)=0; (i)<(N); (i)++)
#define revrep(i,N) for(int (i)=(N)-1; (i)>=0; (i)--)
#define dump(vec) for(int i = 0; i < (vec).size(); i++){cout << vec.at(i) << ",";}cout << endl

typedef long long ll;

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

    if (a+b+c >= 22 ){
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A,B,C;

		B = sc.nextInt();
		C = sc.nextInt();
		A = sc.nextInt();

		System.out.println(A + " " + B + " "  + C);
	}
}

Measured memory_bytes: 39400
#include<stdio.h>
#define MAX 100000

int A[MAX],n;

int partition(int p,int r){
  int i, j, s, t;
  s = A[r];
  i = p-1;
  for(j=p; j<r; j++){
    if(A[j] <= s){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }

  t = A[i+1];
  A[i+1] = A[r];
  A[r] = t;

  return i+1;
}

int main(){
  int i, q;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%d", &A[i]);
  }
  q = partition(0,n-1);

  for(i =0; i<n; i++){
    if(i)       printf(" ");
    if(i==q)    printf("[" );
    printf("%d", A[i]);
    if(i==q)    printf("]" );
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define INF 114514

int h, w, shiro;
char maze[52][52];
int d[52][52], dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
    

int bfs() {
    queue<pair<int, int> > que;
    for (int i = 0; i < 52; i++) {
        for (int j = 0; j < 52; j++) {
            d[i][j] = INF;
        }
    }
    que.push({1, 1});
    d[1][1] = 0;
    while (que.size()) {
        pair<int, int> p = que.front(); que.pop();
        if (p.first == h && p.second == w) break;
        for (int i = 0; i < 4; i++) {
            int nx = p.first + dx[i], ny = p.second + dy[i];
            if (1 <= nx && nx <= h && 1 <= ny && ny <= w && maze[nx][ny] != '#' && d[nx][ny] == INF) {
                que.push({nx, ny});
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
}

int main(void) {
    cin >> h >> w;
    for (int i = 0; i <= h + 1; i++) {
        for (int j = 0; j <= w + 1; j++) {
            if (i == 0 || i == h + 1 || j == 0 || j == w + 1) maze[i][j] = '#';
            else {
                char s;
                cin >> s;
								if (s == '.') shiro++;
                maze[i][j] = s;
            }
        }
    }
    bfs();
    cout << (d[h][w] != INF ? shiro - d[h][w] - 1 : -1) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
#define pb push_back
#define vec vector<int>
using namespace std;
main()
{
  int h,w,k;
  cin>>h>>w>>k;
  char M[h][w];
  int i,j;
  for(i=0;i<h;i++)
  {
    for(j=0;j<w;j++)
        cin>>M[i][j];
  }
  int t=0;
  for(i=0;i<h;i++)
  {
    for(j=0;j<w;j++)
    {
      if(M[i][j]=='#')
            t++;
    }
  }
  int ans=0;
  for(i=0;i<(1<<h);i++)
  {
    int p=0;
    map<pair<int,int>,int> m,m1;
    for(j=0;j<h;j++)
    {
      if(i&(1<<j))
      {
        for(int u=0;u<w;u++)
            if(M[j][u]=='#' && !m[{j,u}])
            p++,m[{j,u}]++;
      }
    }
    int y=p;
    m1=m;
    for(j=0;j<(1<<w);j++)
    {
      for(int r=0;r<w;r++)
      {
        if(j&(1<<r))
        {
          for(int u=0;u<h;u++)
              if(M[u][r]=='#' && !m[{u,r}])
              p++,m[{u,r}]++;
        }
      }
      if(t-p==k)
        ans++;
      p=y;
      m=m1;
    }
  }
  cout<<ans<<"\n";
}


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

int mod = 1000000007;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int>list(N);
    for (int i = 0; i < N; i++)
        cin >> list[i];
    sort(list.begin(), list.end());
    int64_t count = 0;
    for (int i = 0; i < N - K; i++)
        count += list[i];
    cout << count;
}

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


void solve(long long A, long long B, long long K){
  for(auto i=A;i<=B;++i){
    if(i<A+K || B-K<i){
      cout << i << "\n";
    }
  }
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  long long K;
  scanf("%lld",&K);
  solve(A, B, K);
  return 0;
}


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

int main(){
  int d,n;
  cin >> d >> n;
  if (n != 100){
    if (d == 2){
      cout << n*100*100 << endl;
    }
    else if (d == 1){
      cout << n*100 << endl;
    }
    else {
      cout << n << endl;
    }
  }
  else {
    if (d == 2){
      cout << n*100*100+10000 << endl;
    }
    else if (d == 1){
      cout << n*100+100 << endl;
    }
    else {
      cout << n+1 << endl;
    }
  }
}

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

int main (void)
{
    char S[11];
    scanf("%s", S);
    int N = strlen(S);
//    printf("%d", N);
    int i;
    int k = 0;
    char *result = "WA";
    if (S[0] == 'A') {
        for (i = 2; i < N - 1; i++) {
            if (S[i] == 'C') {
                k++;
            } else if (S[i] >= 65 && S[i] <= 90) {
                k = 0;
                break;
            }
        }
        if ((k == 1) && (S[1] >= 97 && S[1] <= 122) && (S[N - 1] >= 97 && S[N - 1] <= 122)) result = "AC";
    }
    printf("%s", result);

    return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
int main() {
    int N;
    cin >> N;

    vector<int> A(N);

    for (int i = 0; i < N; i++){
        cin >> A.at(i);
    }

    int sum = 0;
    bool flag = true;
    while(flag){
        for (int i = 0; i < N; i++){
            if (A.at(i) % 2 != 0){
                flag = false;
             }
            else{
                A.at(i) /= 2;
            }
        }
        sum++;
    }
    cout << sum - 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,a;
    cin>>x>>a;
    if(x<a)
    {
        cout<<0<<endl;
    }
    else if(x>a)
    {
        cout<<10<<endl;
    }
    else
    {
        cout<<10<<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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; }

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

    bool ok = true;
    rep(i, n) {
        if (i == 0) continue;
        if (s[i] != '9') ok = false;
    }

    int ans = (s[0] - '1') + 9 * (n - 1);
    if (ok) ans++;
    cout << ans << endl;
}


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

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();
        int h = sc.NextInt();
        int w = sc.NextInt();
        int[,] c = new int[10, 10];

        for (int i = 0; i < 10; i++)
            for (int j = 0; j < 10; j++)
                c[i, j] = sc.NextInt();

        for (int k = 0; k < 10; k++)
            for (int i = 0; i < 10; i++)
                for (int j = 0; j < 10; j++)
                    if (c[i, j] > c[i, k] + c[k, j]) c[i, j] = c[i, k] + c[k, j];

        int sum = 0;
        for (int i = 0; i < h; i++)
            for (int j = 0; j < w; j++)
            {
                int a = sc.NextInt();
                if (a >= 0) sum += c[a, 1];
            }
        Console.WriteLine(sum);
    }

    static long Gcd(long a, long b)
    {
        if (a < b) return Gcd(b, a);
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }

    public long NextLong()
    {
        CheckNext();
        return long.Parse(buf[index++]);
    }

    public double NextDouble()
    {
        CheckNext();
        return double.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}


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

int main() {
	double pi = 3.141592653589793;
	double r, pir;
	cin >> r;
	pir = pi * r;
	cout << fixed << setprecision(5)
			<< pir*r  << " " << pir*2 << endl;
	return 0;
}

Measured memory_bytes: 3276
n,m = map(int,input().split())

a = []
dp = []
mod = 1000000007

for i in range(100100):
	a.append(0)
	dp.append(0)

for i in range(m):
	num = int(input())
	a[num] = 1

dp[0]=1

for i in range(1,n+1):
	if a[i] == 1:
		continue

	dp[i] += dp[i-1]
	if i>1:
		dp[i] += dp[i-2]

	dp[i] = dp[i] % mod

print(dp[n]%mod)

Measured memory_bytes: 13604
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

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

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
a=[]
for i in range(h):
    tmp=str(input())
    if '#' in tmp:
        a.append(tmp)
delete=[-1]
for i in range(w):
    for j in range(len(a)):
        if a[j][i]=='#':
            break
        else:
            if j==len(a)-1:
                delete.append(i)
if delete==[]:
    delete.append(w)
for i in range(len(a)):
    for j in range(1,len(delete)):
        print(a[i][delete[j-1]+1:delete[j]],end="")
    if delete[-1]<w-1:
        print(a[i][(delete[-1]+1):],end="")
    print("")

Measured memory_bytes: 3444
# import numpy as np
# import math
# import copy
import sys
# input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    C = input()
    alpha = 'abcdefghijklmnopqrstuvwxyz'

    for i in range(len(alpha)):
        if C == alpha[i]:
            print(alpha[i+1])
            break



main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<pll> vpl;
typedef vector<int> vi;
const ll mod = 1000000007; // faster if const
const int N = 200005;
ll fat[N] , ifat[N];
ll modpow(ll b, ll e) {
	ll ans = 1;
	for (; e; b = b * b % mod, e /= 2)
		if (e & 1) ans = ans * b % mod;
	return ans;
}

int32_t main(){
	fat[0] = 1;
	rep(i,1,N) fat[i] = (i*fat[i-1])%mod;
	ifat[N-1] = modpow(fat[N-1] , mod - 2);
	per(i,0,N-1) ifat[i] = (ifat[i+1] * (i+1))%mod ; 
	auto choose = [&](ll a , ll b){
		if(a < b) return 0ll;
		ll c = a - b;
		ll p = (fat[a] * ifat[b])%mod;
		return (p*ifat[c])%mod; 
	};
	ll n , k ;
	cin >> n >> k ;
	ll ans = 0 ;
	rep(i,0,min(n,k+1)){
		ll p = choose(n,i); 
		p = (p*choose(n-1 , i)) % mod;
		ans = (ans + p)%mod;
	}	
	cout << ans << endl;
}

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

typedef long long ll;

int main() {
    string s, t;
    cin >> s >> t;
    ll ans = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != t[i]) {
            ans++; 
        }
    }
    cout << ans << endl;
}


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

bool isprime(int n){
    double rootn = sqrt(n);
    if (n < 2){
        return false;
    }
    else if (n == 2){
        return true;
    }
    else if (n % 2 == 0){
        return false;
    }
    else{
        for(int i = 3; i <= rootn; i += 2){
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }
}


int main(){
    ll N, K;
    ll mod = 1000000007;
    cin >> N >> K;
    ll ans = (((N+1)*(N+K)*(N-K+1)/2 - (N*(N+1)*(2*N+1)/6-(K-1)*K*(2*K-1)/6))%mod + N-K+2)%mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3680
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class Main {
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
    	String S = sc.nextToken();
    	char[] array = S.toCharArray();

    	int count = 0;
    	for(int i = 0; i < N - 1; i++){
      		if(array[i] != array[i + 1]){
        		count++;
      		}
    	}
    	System.out.println(count + 1);
	}

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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


Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<ll> a(n+1),sum(n+1,0),f(n+1),g(n+1);
	FOR(i,1,n+1){
		cin>>a[i];
		sum[i]=sum[i-1]+a[i];
	}
	ll l=1;
	ll p,q,R,S,mi;
	f[2]=1;
	FOR(r,3,n-1){
		p=sum[l],q=sum[r]-sum[l],mi=abs(p-q);
		l++;
		while(l<r){
			p=sum[l],q=sum[r]-sum[l];
			if(mi<abs(p-q)){
				break;
			}
			mi=abs(p-q);
			l++;
		}
		l--;
		f[r]=l;
	}
	g[n-2]=n-1;
	ll r=n-1;
	for(ll l=n-3;l>=2;l--){
		S=sum[n]-sum[r],R=sum[r]-sum[l],mi=abs(S-R);
		r--;
		while(l<r){
			S=sum[n]-sum[r],R=sum[r]-sum[l];
			if(mi<abs(S-R)){
				break;
			}
			mi=abs(S-R);
			r--;
		}
		r++;
		g[l]=r;
	}
	ll ans=inf;
	//cout<<g<<endl;
	FOR(i,2,n-1){
		p=sum[f[i]],q=sum[i]-sum[f[i]];
		R=sum[g[i]]-sum[i],S=sum[n]-sum[g[i]];
		//cout<<i<<endl;
		ll cnt=max({p,q,R,S})-min({p,q,R,S});
		//cout<<p<<' '<<q<<' '<<R<<' '<<S<<' '<<cnt<<endl;
		chmin(ans,cnt);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 8576
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
ans=0

for i in range(N):
  A=list(map(int,input().split()))
  tmp=C
  for j in range(M):
    tmp+=A[j]*B[j]
  if tmp>0:
    ans+=1

print(ans)

Measured memory_bytes: 3060
// coded by zeffy
#pragma GCC optimize("O3","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zeroupper") //Enable AVX
#pragma GCC target("avx","popcnt")  //Enable AVX
#include <x86intrin.h> //SSE Extensions
#include <bits/stdc++.h> 
using namespace std;
#define eb emplace_back
#define mp make_pair
#define hello cout<<"hello"<<"\n"
#define forr(i,a,b) for(int i=a;i<b;i++)
#define it(s)	for(auto itr:s)
#define dvg(s) 	for(auto itr:s)	cout<<itr<<" ";cout<<endl;
#define dbg(s)	cout<<#s<<"= "<<s<<endl;
typedef long long int lli;
typedef unsigned long long int ulli;
const lli INF=(lli)1e17+5;
const ulli MOD=1e8+7;

int main()
{
   int n,k;cin>>n>>k;
   lli h[n];
   forr(i,0,n) cin>>h[i];

   lli dp [n];memset(dp,INF,sizeof(dp));
   
   dp[0]=0;dp[1]=abs(h[1]-h[0]);
   forr(i,0,n)
   {
      for(int j=max(0,i-k);j<i;j++)
      {
         dp[i]=min(dp[i],abs(h[i]-h[j])+dp[j]);
      }
   }
   
   cout<<dp[n-1]<<"\n";
   return 0;
}
   


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

int main() {
	int n, d, x;
	cin >> n >> d >> x;

	int a[100], sum = x;
	for (int i = 0; i < n; i++) {
		cin >> a[i];

		int day = 0;
		for (int j = 0;; j++) {
			day = 1 + a[i] * j;
			if (day > d) break;
			sum++;
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define MOD 1000000007

int main(void){
	int n,x[123456],y[123456],t[123456],i,dt,dd;
	bool ans = true;
	x[0] = 0;
	y[0] = 0;
	t[0] = 0;
	cin >> n;
	for(i=1; i<=n; i++){
		cin >> t[i] >> x[i] >> y[i];
	}
	for(i=1; i<=n; i++){
		dt = t[i] - t[i-1];
		dd = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]);
		if(dt<dd || (dt-dd)%2==1){
			ans = false;
			cout << "No" << endl;
			break;
		}
	}
	if(ans){
		cout << "Yes" << endl;
	}
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#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())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int main(void){
    string a;
    cin >> a;
    string b;
    cin >> b;

    if (b == a + b[a.size()]) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    

    
    

}

Measured memory_bytes: 3628
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def evenodd(n):
    if n % 2 == 0:
        return [n // 2, n // 2]
    else:
        return [(n - 1) // 2, (n + 1) // 2]


s = readline().decode().rstrip()

s = s+'R'
ans = [0] * (len(s))
rcnt = 0
lcnt = 0
for i in range(len(s)):
    if s[i] == 'R':
        rcnt += 1
        if lcnt >= 1 and rcnt == 1:
            c = evenodd(lcnt)
            ans[i - lcnt - 1] += c[0]
            ans[i - lcnt] += c[1]
            lcnt = 0
    if s[i] == 'L':
        lcnt += 1
        if lcnt == 1 and rcnt >= 1:
            c = evenodd(rcnt)
            ans[i - 1] += c[1]
            ans[i] += c[0]
            rcnt = 0

print(*ans[:-1:])


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

int main() {
  int N, K, B;
  cin >> N >> K;
  priority_queue<int, vector<int>, greater<int>> A;
  for (int i = 0; i < N; i++) {
    cin >> B;
    A.push(B);
  }
  int count = 0;
  for (int i = 0; i < K; i++) {
    count += A.top();
    A.pop();
  }
  cout << count << endl;
}
  


Measured memory_bytes: 3632
# %% constants & libraries
# ------------------------

# %% body
# -------

function main(io = stdin)
    readto(target = '\n') = readuntil(io, target)
    readnum(T::Type{<:Number} = Int; dlm = isspace, kwargs...) =
        parse.(T, split(readto(), dlm; kwargs...))::Vector{T}

    # handle IO and and stuff
    N, X, T = readnum()
    println(ceil(Int, N/X) * T)
end

function solve()
    # ...
end

@static if @isdefined(Juno) || @isdefined(VSCodeServer)
    main(open(replace(@__FILE__, r"(.+)\.jl" => s"\1.in")))
else
    main()
end


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

int main(){
  ll i,N,c=0;
  cin>>N;
  vector<ll> x(N);
  rep(i,N)cin>>x[i];
  sort(x.begin(),x.end());
  if(N%3==0&&(x[0]^x[N/3]^x[N-1])==0&&x[0]==x[N/3-1]&&x[N/3]==x[N/3*2-1]&&x[N/3*2]==x[N-1])c++;
  if(x[0]==x[N-1]&&x[0]==0)c++;
  if(c>0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No" <<endl;
  }
  return 0;
}


Measured memory_bytes: 1024
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
        
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())
      
n,m = map(int,input().split()) 

uf = UnionFind(n)
for i in range(m):
  x,y,z = map(int,input().split())
  uf.union(x-1,y-1)
  
print(uf.group_count())  

Measured memory_bytes: 7856
s = input()
acgt = []
cnt = 0
for a in s:
    if a == 'A' or a == 'C' or a == 'T' or a == 'G':
        cnt += 1
    else:
        acgt.append(cnt)
        cnt = 0
acgt.append(cnt)
print(max(acgt))
        

Measured memory_bytes: 2940
import math

f = [int(i) for i in input().split()]
a = f[0]
b = f[1]

a_lower = math.ceil(a/0.08)
a_upper = int((a+1)/0.08)
b_lower = math.ceil(b/0.1)
b_upper = int((b+1)/0.10)

#print(a_lower,a_upper,b_lower,b_upper)
g = 0
for i in range((a_lower),(a_upper)):
  if (b_lower <= i < b_upper):
    print(str(int(i)))
    g = 1
    break
if g == 0:
  print("-1")

Measured memory_bytes: 3064
from fractions import gcd
 
def lcm(a, b):
    return a * b // gcd (a, b)

def nlcm(nums):
    d = 1
    for num in nums:
        d = lcm(d,num)
    return d
 
if __name__ == '__main__':
    N = int(input())
    nums = []
    for i in range(N):
        nums.append(int(input()))
 
    print(nlcm(nums))

Measured memory_bytes: 5588
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    rep(i, N) cin >> X.at(i);

    int min_p = 10000000;
    sort(all(X));
    int S = X.at(0);
    int E = X.at(X.size() - 1);
    repi(i, S, E + 1) {
        int sum = 0;
        rep(j, N) {
            int D = X.at(j) - i;
            sum += pow(D, 2);
        }
        min_p = min(sum, min_p);
    }

    cout << min_p << endl;
}

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

int main(){
  
  int i,j,k;
  char a;
  scanf("%d",&j);
  
  for(i=0;i<j;i++){
    scanf("%c ",&a);
    if((int)a == 89){
      puts("Four");
      return 0;
    }
  }
  
  puts("Three");
  return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, T: int):
    ret = (T // A) * B
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    solve(A, B, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
# frozen_string_literal: true

n, m = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)
ab = m.times.map { gets.split.map(&:to_i) }

d = Array.new(n) { [] }

ab.each do |e|
  a = e[0] - 1
  b = e[1] - 1
  d[a].push b
  d[b].push a
end
count = 0
d.each_with_index do |e, i|
  count += 1 if e.all? { |f| h[f] < h[i] }
end
puts count


Measured memory_bytes: 27184
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int n,cnt=1;
string s[200005];

int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
	}
	sort(s,s+n);
	for(int i=1;i<n;i++)
	{
		if(s[i]!=s[i-1]) cnt++;
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 9892
#include<bits/stdc++.h>
using namespace std;
#define int 		  long long
#define	pb 			  push_back
#define all(a)		  (a).begin(),(a).end()
#define sz(x)		  (int)x.size()
#define endl	 	  "\n"
#define inf 		  1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
//int dp[1000001] = {0};

int counter(int x) {
    if(x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}
void solve(){
	int N, A[20], x[20][20], y[20][20], res=0	;
	cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
        for(int j = 1; j <= A[i]; j++) {
            cin >> x[i][j] >> y[i][j];
        }
    }
	int ans = 0;
    for(int bits = 1; bits < (1 << N); bits++) {
        bool ok = true;
        for(int i = 1; i <= N; i++) {
            if(!(bits & (1 << (i-1)))) continue;
            for(int j = 1; j <= A[i]; j++) {
                if(((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
            }
        }
        if(ok) ans = max(ans, counter(bits));
    }
    cout << ans << endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t=1;
	//cin>>t;
	FOR(i, 1, t+1){	
	//	cout<<"Case #"<<i<<":"<<endl;
		solve();
	}
	return 0;
 
}


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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ll long long

static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;



// 深さ優先探索
vector<bool> seen;
vector<int> colors;


typedef vector<vector<int> > Matrix;

const ll INF = 1e18;

// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 入力
// 入力
int H, W;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
queue<pair<int, int>> que;


int main() {

    ll N;
    cin >> N;
    vector<ll> a(N);
    ll sum = 0;
    REP(i, N){
        cin >> a[i];
        sum ^= a[i];
    }
    REP(i, N){
        cout << (sum ^ a[i]) << " ";
    }
      

}

/*
みんな、くるくるぱーにな〜れ
　∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/



Measured memory_bytes: 4840
#include <iostream>

using namespace std;

long long pow2(int n) {
  long long ret = 1;
  for (int i = 0; i < n; ++i)
    ret *= 2;
  return ret;
}

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

  int n, p;
  cin >> n >> p;

  int a;
  int no = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    if (a % 2 == 1)
      ++no;
  }
  if (p == 0) {
    if (no == 0)
      cout << pow2(n) << endl;
    else
      cout << pow2(n - 1) << endl;
  } else { // p == 1
    if (no == 0)
      cout << 0 << endl;
    else
      cout << pow2(n - 1) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j,n,num,m,k,a[101][101]={};
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d%d",&num,&k);
    for(j=0;j<k;j++){
      scanf("%d",&m);
      a[num][m]=1;
    }
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      printf("%d",a[i][j]);
      if(j==n){
	printf("\n");
      }else{
	printf(" ");
      }
    }
  }
  return 0;
}



Measured memory_bytes: 2108
N,W=map(int,input().split())
v=[]
w=[]
for i in range(N):
   v_i,w_i=map(int,input().split())
   v.append(v_i)
   w.append(w_i)

DP=[[0]*(W+1) for i in range(N+1)]

for i in range(1,N+1):
   for j in range(W+1):
      if j >= w[i-1]:
         DP[i][j]=max(DP[i-1][j],DP[i-1][j-w[i-1]]+v[i-1])
      else:
         DP[i][j]=DP[i-1][j]

print(DP[N][W])


Measured memory_bytes: 25496