akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;


    class Program
    {
        static void Main(string[] args)
        {
            string N =Console.ReadLine();
            string Tom="";
            switch(N)
            {
                case "Sunny":
                 Tom = "Cloudy";
                 break;
                case "Cloudy":
                 Tom = "Rainy";
                 break;
                case "Rainy":
                 Tom = "Sunny";
                 break;


            }            
            
            Console.WriteLine(Tom);

        }

    }



Measured memory_bytes: 11092
#include <iostream>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
using namespace std;
int n;

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};
int main(){
    cin >> n;
    int p[n];
    rep(i,n) cin>>p[i];
//    inputArray(p,n);
    int counter = 0;
    bool frag = true;
    while(frag){
        for(int i = 0; i < n; i++){
            if(p[i]%2 == 0){
                p[i] /= 2;
            }else{
                frag = false;
            }
        }
        if(frag) counter++;
    }
    cout << counter << endl;
    return 0;
}

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

int main(){
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  
  transform(s1.begin(), s1.end(), s1.begin(), ::toupper);
  transform(s2.begin(), s2.end(), s2.begin(), ::toupper);
  transform(s3.begin(), s3.end(), s3.begin(), ::toupper);

  cout << s1[0] << s2[0] << s3[0] << endl; 
  return 0;
}




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

int main(void)
{
    int N, Q;
    cin >> N >> Q;

    vector<vector<int>> vvi(N, vector<int>());
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;

        a--;
        b--;

        vvi[a].push_back(b);
    }

    vector<long long> add(N, 0);
    for (int i = 0; i < Q; i++) {
        int p, x;
        cin >> p >> x;

        p--;

        add[p] += x;
    }

    vector<long long> score(N, 0);
    for (int i = 0; i < N; i++) {
        score[i] += add[i];

        for (int j = 0; j < (int)vvi[i].size(); j++) {
            int index = vvi[i][j];

            add[index] += add[i];
        }
    }

    for (int i = 0; i < N; i++)
        cout << score[i] << (i == N - 1 ? '\n' : ' ');


    return 0;
}


Measured memory_bytes: 16512
#include <iostream>
using namespace std;
int main(void){
int a,b;
cin>>a>>b;

if (a==b){cout<<"Draw";}
else if (b==1 && a!=1){cout<<"Bob";}
else if (a==1 && b!=1){cout<<"Alice";}
else if (a>b){cout<<"Alice";}
else if (a<b){cout<<"Bob";}


}


Measured memory_bytes: 256
N,M = map(int,input().split())
l,r = map(int,input().split())
k = min(r,N)
for i in range(M-1):
    ll,rr = map(int,input().split())
    if ll>k or rr<l:
        print(0)
        exit()
    if ll >l : l = ll
    if rr < k : k = rr

print(k-l+1)


Measured memory_bytes: 3060
l, r = map(int, input().split())

mod = 2019
minij = 2020

for i in range(l, r):
    for j in range(i+1, r+1):
        if (i * j) % mod < minij:
            minij = (i*j) % mod
            if minij == 0:
                print(minij)
                exit(0)

print(minij)

Measured memory_bytes: 38768
#include<bits/stdc++.h>
#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 ll long long
#define lb(x) ((x)&(-x))
#define pii pair<int,int>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define de(x) cout<<x<<" x"<<endl
#define LCAFA rep(i,1,20)rep(j,1,n+1)fa[j][i]=fa[fa[j][i-1]][i-1]
#define all(x) x.begin(),x.end()
#define ls(x) x<<1
#define rs(x) x<<1|1
using namespace std;
const int N=2e5+9;
const ll mod=998244353;
vector<pair<double,int>> g;
ll dp[N][40];
int a[N],b[N];
vi p;
void upd(ll &a,ll b){
	if(a>b)a=b;
}
int main(){
//	freopen("text.in","r",stdin);
	int n,t;
	scanf("%d%d",&n,&t);
	++t;
	rep(i,1,n+1){
		scanf("%d%d",&a[i],&b[i]);
		++a[i],++b[i];
		if(a[i]>=2)g.pb({1.0*(a[i]-1)/b[i],i});
		else p.pb(b[i]);
	}
	sort(g.rbegin(),g.rend());
	sort(p.begin(),p.end());
	rep(i,0,N)rep(j,0,40)dp[i][j]=1e12;
	dp[0][0]=1;
	rep(i,1,g.size()+1){
		rep(j,0,40){
			int k=g[i-1].se;
			if(dp[i-1][j]<=t)upd(dp[i][j],dp[i-1][j]);
			if(j&&dp[i-1][j-1]<=t&&dp[i-1][j-1]*a[k]+b[k]<=t)upd(dp[i][j],dp[i-1][j-1]*a[k]+b[k]);
		}
	}
	ll sum=0;
	int pos=0,ans=0;
	per(j,0,40){
	//	cout<<cnt<<' '<<j<<' '<<dp[cnt][j]<<"dp\n";
	//	cout<<dp[g.size()][j]+sum+p[pos]<<"why\n";
		while(pos<p.size()&&dp[g.size()][j]+sum+p[pos]<=t)sum+=p[pos++];
	//	cout<<dp[g.size()][j]<<' '<<sum<<' '<<j<<' '<<t<<' '<<pos<<"pos\n";
		if(dp[g.size()][j]<=t)ans=max(ans,pos+j); 
	}
	cout<<ans;
} 


Measured memory_bytes: 68460
// Author: Jashan Bansal
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second	
#define mp make_pair
#define int long long
#define ll long long
#define pii pair<int,int>
#define all(arr) arr.begin(), arr.end()
#define sz(arr) ((long long)arr.size())
// const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
#define log1(x) cout << x << '\n'
#define log2(x,y) cout << x << " " << y <<'\n'
#define log3(x,y,z) cout << x <<" " << y <<" " << z << '\n'
#define logarr(arr,n) for(int __=0; __ < n; __++)	cout << arr[__] << " "; cout << '\n'

int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}


void solve() {
	// int n; cin >> n;
	// vi arr(n);
	// for(auto &x: arr) cin >> x;

	string str; cin >> str;
	string str2 ; cin >> str2;

	string str3 = str2.substr(0, str.size());

	cout << ((str3 == str) ? "Yes" : "No");
	


}
 
signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t=1;
	// cin>>t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main(){
	int r,g,b,n;
	cin >> r >> g >> b >> n;
	int ans = 0;
	for(int i=0;i<3001;i++){
		for (int j=0;j<3001;j++){
			int k = n - i*r - j*g;
			if(k>=0&&(k%b==0))ans++;
		}
	}
	cout << ans << endl;
}

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

int main()
{
  int a, b,c;
  cin >> a >> b>> c;
  cout << (a - b) % c << endl;
  
  return 0;
}

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

        int A, B;
        std::cin >> A >> B;

        int ans = 0;
        REP(i, 2) {
            if(A < B) {
                ans += B;
                B--;
            }
            else {
                ans += A;
                A--;
            }
        }

        std::cout << ans << std::endl;
    }
    catch(const exception& e) {
        std::cout << e.what() << std::endl;
        exit(1);
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define ll long long int
using namespace std;
ll ar[200009];
int main()
{
    ll n,i,sum=0,a;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>ar[i];
        if(i>0 && ar[i]<ar[i-1])
        {
            sum+=(ar[i-1]-ar[i]);
            ar[i]=ar[i-1];
        }
    }
    printf("%lld\n",sum);
}


Measured memory_bytes: 5252
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k,x;
    cin >> k >> x;
    int l = x-k+1;
    int r = x+k-1;
    while(l<r){
        cout << l << " ";
        l++;
    }
    cout << r << endl;

    return 0;
}

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

int main()
{
    int n, m;
    std::cin >> n >> m;
    
    constexpr auto MUL = 1000;
    std::vector<int> votes(n);
    int sum = 0;
    for (auto &val : votes)
    {
        std::cin >> val;
        val *= MUL;
        sum += val;
    }

    auto limit = sum / (4*m);
    int realM = 0;
    for (const auto& val : votes)
    {
        if (val >= limit)
        {
            ++realM;
            if (realM >= m)
            {
                std::cout << "Yes";
                return 0;
            }
        }
    }

    std::cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using VI = vector<int>;
using VB = vector<bool>;
using Graph = vector<vector<int>>;
using ll = long long;
using P = pair<int, int>;

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

  int sum = 1;
  for (int i = 1; i < n ; i++){
    if (!(s[i-1] == s[i])) {
      sum += 1;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
void solve(vector<string> ids,vector<string> strs){
    bool s=false,st=false;
    for(string x:strs){
        st=s;
        for(string y:ids){
            if(x==y){
                if(s){
                    s=false;
                    cout<<"Closed by "<<y<<endl;
                }
                else{
                    s=true;
                    cout<<"Opened by "<<y<<endl; 
                }
            }
        }
        if(st==s){
            cout<<"Unknown "<<x<<endl; 
        }
    }
}



int main(void){
    int a;
    string str;
    vector<string> ids,strs;
    cin>>a;
    for(int i=0;i<a;i++){
        cin >> str;
        ids.push_back(str);
    }
    cin >> a;
    for(int i=0;i<a;i++){
        cin >> str;
        strs.push_back(str);
    }
    solve(ids,strs);
}

Measured memory_bytes: 3220
#include <iostream>

using namespace std;

int w[100 + 3] ={0};
int n;
int r[100 + 3] ={0}; 

int main(){
    cin >> n;
    for(int i = 0;i < n*(n-1)/2;i++){
        int a, b, pa, pb;
        cin >> a >> b >> pa >> pb;
        if(pa > pb) {
            w[a] += 3;
        }
        else if(pa ==pb){
            w[a] += 1;
            w[b] += 1;
        }
        else{
            w[b] += 3;
        }
    }
    for(int i = 1;i <= n;i++){
        for(int j = 1; j <= n;j++){
            if(w[i] < w[j]){
                r[i] += 1;
            }
        }
    }    
    for(int i = 1;i <= n;i++){
        cout << r[i] + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
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; }
const int INF = 1e9;
const ll MOD = 1000000007;

using Graph = vector<vector<int>>;

ll modPow(ll x, ll n) {
    if(n==0) return 1;
    ll res = modPow(x*x%MOD, n/2);
    if(n&1) res=res*x%MOD;
    return res;
}
ll mul(ll l, ll r) {
    ll ret =1;
    for(int i=0; i<l-r+1; ++i) {
        ret*=i+r;
        ret%=MOD;
    }
    return ret;
}
ll com(ll n, ll k) {
    ll ret1 = mul(n,n-k+1);
    ll ret2 = mul(k,1);
    ll ret3 = modPow(ret2, MOD-2);
    return ret1*ret3%MOD;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s; cin >> s;
    vector<char> ss;
    rep(i,s.size()) {
        if (s[i]=='0' || s[i]=='1') {
            ss.pb(s[i]);
        } else if (s[i]=='B' && ss.size() != 0) {
            ss.pop_back();
        }
    }
    string sss;
    rep(i,ss.size()) {
        sss += ss[i];
    }
    cout << sss << "\n";


}



Measured memory_bytes: 256
while True:
  n=int(input())
  if n==0:
    break
  for i in range(n):
    m,e,j=map(int,input().split())
    if m==100 or e==100 or j==100:
      print('{}'.format('A'))
    elif ((m+e)/2)>=90:
       print('{}'.format('A'))
    elif ((m+e+j)/3)>=80:
       print('{}'.format('A'))
    elif ((m+e+j)/3)>=70:
       print('{}'.format('B'))
    elif ((m+e+j)/3)>=50:
      if m>=80 or e>=80:
          print('{}'.format('B'))
      else:
        print('{}'.format('C'))
    else:
      print('{}'.format('C'))


Measured memory_bytes: 5616
N = int(input())
A = list(map(int, input().split()))

dic = dict()

for a in A:
    if str(a) in dic:
        dic[str(a)] += 1
    else:
        dic[str(a)] = 1

res = 0
for i, cnt in dic.items():
    ii = int(i)
    if ii < cnt:
        res += cnt - ii
    elif ii > cnt:
        res += cnt

print(res)


Measured memory_bytes: 72488
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(){
	double pai = 3.1415926535;
	int a,b,h,m;
	double sub,ans;
	double harg,marg,barg;
	scanf("%d %d %d %d",&a,&b,&h,&m);
	marg = (double)m*pai/30;
	harg = (double)h*pai/6 + (double)m*pai/360;
	if(harg == marg){
		sub = abs(b-a);
		printf("%.10lf",sub);
		return 0;
	}else if(harg > marg){
		barg = harg - marg;
	}else{
		barg = marg - harg;
	}
	sub = a*a + b*b - 2*a*b*cos(barg);
	ans = sqrt(sub);
	printf("%.10lf",ans);
	
	return 0;
}

Measured memory_bytes: 2596
#include <stdio.h>

int main(){
  long long i,n,w,x=0,z=0;
  long long a[20];

  scanf("%lld",&n);
  for(i=0;n>0;i++){
    a[i]=n%10;
    n=n/10;
    x++;
    z+=a[i];
  }
  z-=a[x-1];
  if(x==1){
    printf("%lld",a[0]);
    return 0;
  }
  if(z==(x-1)*9){
    printf("%lld",z+a[x-1]);
    return 0;
  }
  w=(x-1)*9;
  w+=a[x-1];
  w--;
  printf("%lld",w);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const ll max_co = 3234600000;
int mod =1000000007;
int main(){
   ll n,k;
   cin>>n>>k;
   ll c=n/k;
   ll d=c*c*c;
   if(k%2==0){
      if(k*c+k/2<=n)c++;
      d+=c*c*c;
   }
   cout<<d<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define befv(V) ((V)[sz(V)-2])
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define upmax(a,b) (a)=max((a),(b))
#define upmin(a,b) (a)=min((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (0x3f3f3f3f)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 200005;

int A[MAXN], O[MAXN];
int d[MAXN];

int N, Ans = INF;

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

	cin >> N;
	for(int i = 1; i <= N; i++) cin >> A[i];
	for(int i = 1; i <= N; i++) O[A[i]] = i;

	for(int i = 1; i <= N; i++) {
		d[i] = 1;
		if(O[i-1] < O[i]) upmax(d[i], d[i-1] + 1);
	}

	cout << (N - *max_element(d+1, d+N+1)) << endl;
	return 0;
}


Measured memory_bytes: 2560
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (LLONG_MAX - 1e5)
#define fcout cout << fixed << setprecision(10)

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int N;
    cin >> N;
    vector<int> a(N);
    REP(i, N) cin >> a[i];

    bool bFirst = false;
    REP(i, N) {
        if (a[i] % 2 != 0) {
            bFirst = true;
            break;
        }
    }
    cout << (bFirst ? "first" : "second") << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main(void){
   int a,b,c,min,mid,max,x1,x2;
   
   scanf("%d %d %d",&a,&b,&c);
   
   if(a<b){
       x1=a; x2=b;
       }
   else{
       x1=b; x2=a;
       }
   
   if(x1<c){
       min=x1;
       if(x2<c){
           mid=x2; max=c;
       }
       else{
           mid=c; max=x2;
       }
       }
   else{
       min=c; mid=x1; max=x2;
   }
   
   printf("%d %d %d\n",min,mid,max);
   
   
    return 0;
    
}


Measured memory_bytes: 2120
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();

		if(y>=r && y<=H-r && x>=r && x<=W-r){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}




Measured memory_bytes: 26384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main(){
    string s[]={"AC","WA","TLE","RE"};
    ll n;cin>>n;
    ll sum[4];rep(i,0,3)sum[i]=0;
    rep(i,0,n-1){
        string t;cin>>t;
        rep(j,0,3){
            if(t==s[j]){
                sum[j]++;
            }
        }
    }
    rep(i,0,3){
        cout<<s[i]<<" x "<<sum[i]<<endl;
    }
    
    return 0;
}



Measured memory_bytes: 3536
#pragma region
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define VPII vector<PII>
#define VPLL vector<PLL>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
constexpr int INF=1<<30; constexpr ll LINF=1LL<<60; constexpr ll mod=1e9+7; constexpr int NIL = -1;
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; }
#pragma endregion
//-------------------
int c[10][10];

int main(){
    cin.tie(0); ios::sync_with_stdio(false); //cout << fixed << setprecision(15);
    int h, w, k; cin >> h >> w >> k;
    FOR(i,0,h-1) {
        FOR(j,0,w-1) {
            char ch; cin >> ch;
            if(ch=='#') c[i][j] = 1;
            else c[i][j] = 0;
            // cout << c[i][j];
        }
    }
    int ans = 0;    
    FOR(i,0,(1<<h)-1) {
        FOR(j,0, (1<<w)-1) {
            int cur = 0;
            FOR(y,0,h-1) {
                FOR(x,0,w-1) {
                    if(((i>>y)&1)!=1 and ((j>>x)&1)!=1 and c[y][x] == 1) cur++;
                }
            }
            if(cur == k) ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int n;cin>>n;
    long long int t,a[n],s[n],ans=0;
    
    cin>>t>>a[0];
    for(int i=1;i<n;++i){
        cin>>a[i];
        s[i-1]=a[i]-a[i-1];
    }

    for(int i=0;i<n-1;++i){
        if(s[i]<=t)ans+=s[i];
        else ans+=t;
    }
    ans+=t;
    
    cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3328
#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 <stdlib.h>
#include <stdio.h>

using namespace std;

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

int absA(long long num) {
    if (num > 0)
        return num;
    else
        return -num;
}

int absB(long long num,long long numb) {
    if (num - numb >= 0)
        return num - numb;
    else
        return -1 * (num - numb);
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}



const long long INF = 100100100100;

int main() {
    int N;
    string ans = "APPROVED";
    cin >> N;
    vector<int> retu(N);
    for (int i = 0; i < N; i++) cin >> retu.at(i);
    for (int i = 0; i < N; i++) {
        if (retu.at(i) % 2 == 0) {
            if (retu.at(i) % 3 == 0 || retu.at(i) % 5 == 0) {
            
            }
            else {
                ans = "DENIED";
            }
        }
    }

    cout << ans << endl;
}



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

int main() {

  int n;
  cin >> n;
  
  long long sum = 0;
  
  for( int i = 1; i <= n; i++){
    for (int j = 1; j <= n; j++){
      for ( int k = 1; k <= n; k++){
        sum += gcd(i,gcd(j,k));
      }
    }
  }
        
  cout << sum << endl;
  
}



Measured memory_bytes: 3632
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		StringBuilder s = new StringBuilder();
		int m = 0;
		int h = 0;
		while(true){
			s.append(sc.next());
			if(s.toString().equals("-")){
				break;
			}
			m = sc.nextInt();
			for(int i = 0;i < m; i++){
				h = sc.nextInt();
				s.append(s.substring(0,h));
				s.delete(0,h);
			}
			System.out.println(s);
			s.delete(0, s.length());
		}

	}
}



Measured memory_bytes: 26452
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int N=sc.nextInt();
      if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9){
         System.out.println("hon");
      }else if(N%10==0||N%10==1||N%10==6||N%10==8){
         System.out.println("pon");
      }else{
         System.out.println("bon");
      }
   }
}


Measured memory_bytes: 35720
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define double long double
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
#define P pair<int,int>
//printf("%.12Lf\n",);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int max(int a,int b){
	if(a>=b)return a;
	else return b;
}
int min(int a,int b){
	if(a>=b)return b;
	else return a;
}	
int n2[41];		
int nis[41]; 
int nia[41];
int mody[41];
int nn;
int com(int n,int y){
	int ni=1;
	for(int i=0;i<41;i++){
		n2[i]=ni;
		ni*=2;
	}
	int bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	rep(1,i,41){
		bunbo=(bunbo*bunbo)%mod;
		mody[i]=bunbo;
	}
	rep(0,i,41)nis[i]=0;
	nn=mod-2;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	return bunsi;
}
int yakuwa(int n){
	int sum=0;
	rep(1,i,sqrt(n+1)){
		if(n%i==0)sum+=i+n/i;
		if(i*i==n)sum-=i;
	}
	return sum;
}	
bool integer(double n){
	if(n==long(n))return true;
	else return false;	
}
int pow(int b,int a){	
	int aa=1;
	rep(0,i,a)aa*=b;	
	return aa;
}
int sankaku(int a){
	return a*(a+1)/2;
} 
bool search(int x){
	int n;
	int a[n];
	int l=0,r=n;
	while(r-l>=1){
		int i=(l+r)/2;
		if(a[i]==x)return true;
		else if(a[i]<x)l=i+1;
		else r=i;
	}
	return false;
}
int ans[26];
signed main(){
	ic(n)
	cout<<"0 0 ";
	if(n>=999999998000000001&&n<=999999999000000000){
		cout<<999999999<<" "<<1<<" "<<999999999000000000-n<<" "<<1000000000;
		return 0;
	}
	if(n>=999999999000000000&&n<=1000000000000000000){
		cout<<1000000000<<" "<<1<<" "<<1000000000000000000-n<<" "<<1000000000;
		return 0;
	}	
	int sq=long(sqrt(n))+1;
	if((abs(n-sq*sq))%2==0)cout<<sq<<" 2 "<<(sq*sq-n)/2<<" "<<sq<<" ";
	else cout<<sq+1<<" 2 "<<(sq*sq-n-1)/2<<" "<<sq-1<<" ";	
}		

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
struct edge {
    ll to,cost;
};
/*
const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_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 || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
*/

int main(){
    int N,M; cin >> N >> M;
    ll a,b;
    vector<pair<ll,ll> > p(N);
    for (int i = 0; i < N; i++){
        cin >> a >> b;
        p[i] = {a,b};
    }
    sort(p.begin(), p.end());
    //priority_queue<ll, vector<ll>, greater<ll> > pq;
    priority_queue<ll> pq;
    int in = 0;
    ll ans = 0;
    for (int i = 1; i <= M; i++){
        while(p[in].first <= i && in < N){
            pq.push(p[in].second);
            in++;
        }
        //cout << "pq.size() : " << pq.size() << endl;
        if (pq.size()){
            ans += pq.top();
            //cout << "i = " << i << ", pq.top = " << pq.top() << endl;
            pq.pop();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2936
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long MOD = (long)Math.pow(10, 9) + 7;
    int n = sc.nextInt();
    String s1 = sc.next();
    String s2 = sc.next();
    ArrayList<Integer> list = new ArrayList<Integer>();
    for(int i = 0; i < n; i++) {
      if(s1.charAt(i) == s2.charAt(i)) {
        list.add(1);
      } else {
        list.add(0);
        i++;
      }
    }
    long ans = 6;
    if(list.get(0) == 1) ans = 3;
    for(int i = 1; i < list.size(); i++) {
      int p = list.get(i - 1);
      int q = list.get(i);
      if((p == 0) && (q == 0)) ans = (ans * 3) % MOD;
      if((p == 0) && (q == 1)) ans = (ans * 1) % MOD;
      if((p == 1) && (q == 0)) ans = (ans * 2) % MOD;
      if((p == 1) && (q == 1)) ans = (ans * 2) % MOD;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 22996
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
#include <climits>
#include <iomanip>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
constexpr auto INF = ULLONG_MAX;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
template <typename T> inline T max_value(vector<T>& x) { return *max_element(x.begin(), x.end()); }
template <typename T> inline T min_value(vector<T>& x) { return *min_element(x.begin(), x.end()); }
template <typename T> inline T sum_value(vector<T>& x) { return accumulate(x.begin(), x.end(), 0ULL); }

int main() {
  ull n, k;
  cin >> n >> k;

  vector<ull> h = {};
  each(i, n) {
    ull tmp;
    cin >> tmp;
    h.push(tmp);
  }

  sort_desc(h);
  ull result = 0;

  if (k >= n) {
    result = 0;
  } else {
    vector<ull> remain = vector<ull>(h.begin() + k, h.end());
    result = sum_value(remain);
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 3440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    string s;
    cin >> s;
    if (s == "SUN") cout << 7 << endl;
    else if (s == "MON") cout << 6 << endl;
    else if (s == "TUE") cout << 5 << endl;
    else if (s == "WED") cout << 4 << endl;
    else if (s == "THU") cout << 3 << endl;
    else if (s == "FRI") cout << 2 << endl;
    else if (s == "SAT") cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 256
n, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(n)]


def dfs(i, a, b, c):
    if i == n:
        if a < 1 or b < 1 or c < 1:
            return 10 ** 18
        return abs(A - a) + abs(B - b) + abs(C - c)
    return min([
        dfs(i + 1, a, b, c),
        dfs(i + 1, a + l[i], b, c) + (10 if a > 0 else 0),
        dfs(i + 1, a, b + l[i], c) + (10 if b > 0 else 0),
        dfs(i + 1, a, b, c + l[i]) + (10 if c > 0 else 0)])


print(dfs(0, 0, 0, 0))


Measured memory_bytes: 3064
#include<iostream>

using namespace std;

typedef long long ll;

const int N = 100001;
ll dp[101][N];

int main(){
  int n, W;
  cin >> n >> W;
  int w;
  ll v;
  for(int i = 0; i < n; i++){
    cin >> w >> v;
    for(int j = 0; j < W; j++){
      dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
      if(j+w<=W){
        dp[i+1][j+w] = max(dp[i][j]+v,dp[i+1][j+w]);
      }
    }
  }
  ll val = -1;
  for(int i = 0; i <= W; i++)
    val = max(dp[n][i],val);
  cout << val << endl;
  return 0;
}


Measured memory_bytes: 78336
#include <iostream>
#include <vector>
#include <cstdint>
 
using namespace std;
 
int main()
{
	int32_t n, x;
	cin >> n >> x;
 
	vector<int32_t> boxes(n);
	for (auto& x : boxes) {
		cin >> x;
	}
 
	int32_t beforeElement{ 0 }, difference{ 0 };
	int64_t count{ 0 };
	for (auto itr = boxes.begin(); itr != boxes.end(); ++itr) {
		difference = beforeElement + *itr - x;
		if (difference > 0) {
			count += difference;
			*itr -= difference;
		}
		beforeElement = *itr;
	}
 
	cout << count << endl;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define LL long long


using namespace std;
const int maxn=1e5+5;
int gcd(int a , int b)
{
        return a%b==0? b:gcd(b,a%b);
}
inline LL quickread()
{
	LL X=0; bool flag=1; char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') flag=0; ch=getchar();}
	while(ch>='0'&&ch<='9') {X=(X<<1)+(X<<3)+ch-'0'; ch=getchar();}
	if(flag) return X;
	return ~(X-1);
}
int main()
{
    char a,b,c;
    cin>>a;
    cin>>b;
    cin>>c;
    if(a=='R'&&b=='R'&&c=='R')
        cout<<"3"<<endl;
    else if(a=='R'&&b=='R'||b=='R'&&c=='R')
        cout<<"2"<<endl;
    else if(a=='R'||b=='R'||c=='R')
       cout<<"1"<<endl;
    else
        cout<<"0"<<endl;

}


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

int main() {
    int x;
    cin >> x;
    if(x>=400&&x<600){
        cout << 8 << endl;
    }else if(x>=600&&x<800){
        cout << 7 << endl;
    } else if(x>=800&&x<1000){
        cout << 6 << endl;
    }else if(x>=1000&&x<1200){
        cout << 5 << endl;
    }else if (x>=1200&&x<1400){
        cout << 4 <<endl;
    }else if(x>=1400&&x<1600){
        cout << 3 << endl;
    }else if(x>=1600&&x<1800){
        cout << 2 << endl;
    }else{
        cout << 1 << endl; 
    }
}

Measured memory_bytes: 3628
#include <iostream>
#include <bits/stdc++.h>
#include <string>

using namespace std;

int main()
{
  int a,b,c,k,cou=0;
  cin>>a>>b>>c>>k;
  while(b<=a){
    b*=2;
    cou++;
  }
  while(c<=b){
    c*=2;
    cou++;
  }
  if(cou<=k){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3584
///   ***   ---   |||		 In the name of ALLAH		|||   ---   ***   ///



#include<bits/stdc++.h>
using namespace std;


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;

#define endl '\n'
#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {			cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }


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


bool seive[1010000];
vi prime;

void seiveGen(int limit) {
	limit += 100;
	int sqrtn = sqrt(limit);
	for(int i = 3; i <= sqrtn; i += 2) {
			if(!seive[i>>1]) {
					for(int j = i * i; j < limit; j += i + i) {
							seive[j>>1] = 1;
					}
			}
	}
	prime.PB(2);
	for(int i = 3; i < limit; i += 2) {
			if(!seive[i>>1]) prime.PB(i);
	}
}

map<ll, int> cnt;

set<ll> factorize ( ll n )
{
	set<ll> ret;
	for ( auto p : prime ) {
		if ( 1LL * p * p > n || n == 0 ) break;

		if ( n % p == 0 ) {
			ret.insert ( p );

			while ( n % p == 0 ) {
				n /= p;
				cnt[p]++;
			}
		}
	}

	if ( n > 1 ) {
		cnt[n]++;
		ret.insert ( n );
	}

	return ret;
}


ll mypow ( ll a, ll b )
{
	ll ret = 1;
	for ( int i = 0; i < b; i++ ) {
		ret *= a;
	}

	return ret;
}

map<ll, bool> vis;

int main()
{
	optimize();

	seiveGen(1e6);

	ll n;
	cin >> n;
	set<ll> fact = factorize(n);

	for ( auto u : fact ) {
		for ( int i = 1; i <= cnt[u]; i++ ) {
			vis[mypow(u, i)] = 1;
		}
	}

	vl v;
	for ( ll i = 1; i <= n; i++ ) {
		if ( i * i > n ) break;
		if ( n % i == 0 ) {
			if ( vis[i] ) v.PB ( i );
			if ( vis[n/i] == 1 && n / i != i ) v.PB ( n/ i );
		}
	}

	sort ( all ( v ) );

	int ans = 0;
	for ( auto u : v ) {
		if(n == 0) break;
		if ( n % u == 0 ) {
			n /= u;
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


















Measured memory_bytes: 4304
#include<iostream>
#include<string>
#include<algorithm>//sort,reverse
using namespace std;

int main()
{ 
    string s;
    cin>>s;
    int n;
    n=s.size();
    n=n/2;
    int ans=0;
    for(int i=0;i<n;i++){
        if(s[i]!=s[s.size()-i-1]){ans++;}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N, x = map(int, input().split())
A = list(map(int, input().split()))

ans = 0
if A[0] > x:
    ans += A[0] - x
    A[0] = x
for i in range(N-1):
    if A[i] + A[i+1] > x:
        ans += A[i] + A[i+1] - x
        A[i+1] = x - A[i]

print(ans)

Measured memory_bytes: 14052
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    string S;
    cin >> N >> S;
    int val=1;
    if(N%2) val=0;
    for(int i=0; i<N/2; i++){
        if(S.at(i)!=S.at(i+N/2)) val=0;
    }
    if(val) cout << "Yes";
    else cout << "No";
    return 0;
}

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

using namespace std;

bool is_digit(char c) {
    return c >= '0' && c <= '9';
}

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.length();
    int res = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] != t[i]) res++;
    }
    cout << res;

    return 0;
}

Measured memory_bytes: 3920
#include <iostream>

using namespace std;

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

	bool flag = false;


	if (n[0] == n[1] && n[0] != n[2]) {
		flag = true;
	}

	if (n[0] == n[2] && n[0] != n[1]) {
		flag = true;
	}

	if (n[2] == n[1] && n[0] != n[2]) {
		flag = true;
	}

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

	return 0;
}

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

ll g(ll x) {
  ll ans = 0;
  if (x % 2 == 0) ans = x;
  ans +=  ((x+1) / 2) % 2;

  return ans;
}

int main() {
  ll n;
  cin >> n;
  double ans = 0.0;
  rep(i, n) { double x;
    string u;
    cin >> x >> u;
    if (u == "JPY") ans += x;
    else
      ans += 380000.0 * x;
  }
  printf("%.15f\n", ans);
  return 0;
}


Measured memory_bytes: 256
read n a b
ans=0
for (( k = 1; k <= n; k++ )); do
    dsum=0
    for (( j = 0; j < ${#k}; j++ )); do (( dsum += ${k:j:1} )) ; done
    (( dsum >= a && dsum <= b )) && (( ans += k ))
done
echo ${ans}


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

int main()
{
    int n;
    cin >> n;
    if(n % 10 == 0) cout << 10;
    else
    {
        int c = 0;
        while(n)
        {
            c += (n%10);
            n /= 10;
        }
        cout << c;
    }
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    a = LI()
    for i in range(n):
        a[i] -= 1
    ans = 0
    for i in range(n):
        ans += (a[a[i]] == i)&(a[i] > i)
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 52464
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string S;
	cin >> S;
	char prev = ' ';
	int ans = 0;
	for( auto c : S )
	{
		if( prev != ' ' && prev != c )
		{
			++ans;
		}
		prev = c;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
h, w, k = map(int, input().split())
c = [list(input()) for i in range(h)]
 
h1 = [list(f"{i:0{h}b}") for i in range(2**h)]
w1 = [list(f"{i:0{w}b}") for i in range(2**w)]
 
cnt = 0
for hh in h1:
    for ww in w1:
        black = 0
        x = [i for i in range(h) if hh[i]=='1']
        y = [i for i in range(w) if ww[i]=='1']
        for i in x:
            for j in y:
                if c[i][j] == '#':
                    black += 1
        if black == k:
            cnt += 1
            #print(x, y)
 
print(cnt)

Measured memory_bytes: 9012
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int maxW = sc.nextInt();

		long[] weight = new long[n*1000+1];
		
		for (int i=1;i<=n*1000;i++) {
			weight[i] = Long.MAX_VALUE/2;
		}


		for (int i=0;i<n;i++) {
			int w = sc.nextInt();
			int v = sc.nextInt();
			for (int j=n*1000-v;j>=0;j--) {
				weight[j+v]=Math.min(weight[j+v],weight[j]+w);
			}
		}

		long ans = 0;
		for (int i=0;i<=n*1000;i++) {
			if (weight[i]<=maxW) {
				ans = i;
			}
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 23124
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string N;cin>>N;
  string x="000";
  if(N[0]<N[1]||(N[0]==N[1]&&N[1]<N[2])){
    repeat(i,3){
      x[i]=N[0]+1;
    }
  }else{
    repeat(i,3){
      x[i]=N[0];
    }
  }
  cout<<x<<endl;
  return 0;
}


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

int main() {
  int N;
  ll K;
  cin >> N >> K;
  vector<int> A(N + 1, 0);
  rep(i, N) {
    cin >> A.at(i + 1);
  }

  vector<int> root(N + 1, 0);
  int p = 0;
  int i = 0;
  A.at(p) = 1;
  while (true) {
    i++;
    p = A.at(p);  // go next
    if (root.at(p) > 0) break;
    root.at(p) = i;  // mark
  }
  int offset = root.at(p) - 1;
  int loop = i - root.at(p);

  // K -= offset;
  // K %= roop;
  if (K > offset) {
    K = (K - offset) % loop + offset;
  }
  int ans = 1;
  rep(i, K) {
    ans = A.at(ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4812
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <algorithm>

int testcase_ends() {
  int D;
  double E;
  scanf("%d %lf", &D, &E);
  if (D == 0 && E == 0) return 1;

  double res = 100;
  for (int i = 0; i <= D; ++i)
    res = std::min(res, std::abs(std::hypot(i, D-i)-E));

  printf("%.12f\n", res);
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



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

using namespace std;

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

    int R, S, P;
    cin >> R >> S >> P;

    string T;
    cin >> T;

    int sum = 0;

    for (int i = 0; i < K; i++) {
        if (T[i] == 'r') sum += P;
        if (T[i] == 's') sum += R;
        if (T[i] == 'p') sum += S;
    }

    for (int i = K; i < N; i++) {
        if (T[i] == T[i - K]) {
            T[i] = 'n';
        } else {
            if (T[i] == 'r') sum += P;
            if (T[i] == 's') sum += R;
            if (T[i] == 'p') sum += S;
        }
    }

    cout << sum << endl;
}


Measured memory_bytes: 512