akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
using namespace std;
typedef unsigned long long ullong;

ullong power(ullong x,ullong n,ullong M){
    ullong res=1;
    if(n>0){
        res=power(x,n/2,M);
        if(n%2==0)res=(res*res)%M;
        else res=(((res*res)%M)*x)%M;
    }
    return res;
}

int main(void){
    int m,n;
    cin>>m>>n;
    cout<<power(m,n,1000000007)<<endl;
    return 0;
}



Measured memory_bytes: 3096
#include <iostream>
using namespace std;
int main(int argc, const char * argv[])
{
    int a[10005];
    int i,j;
    i=0;
    a[0] = 1;
    while( a[i] != 0)
    {
        i += 1;
        cin >> a[i];
    }
    for(j=1;j<i;j++)
    {
        cout << "Case " << j << ": " << a[j] << endl;
    }
    return 0;
}

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

using namespace std;

template <typename T>
struct SegmentTree {
  int SEG_LEN = 1;
  std::vector<T> node;
  SegmentTree(int n) {
    while (SEG_LEN < n) { SEG_LEN <<= 1; }
    node.assign(SEG_LEN*2, 0);
  }
  void add(int l, int r, T x) {
    l += SEG_LEN; r += SEG_LEN;
    while (l < r) {
      if (l & 1) { node[l++] += x; }
      if (r & 1) { node[r-1] += x; r--; }
      l >>= 1; r >>= 1;
    }
  }
  T get(int idx) {
    idx += SEG_LEN;
    T ret = node[idx];
    while (true) {
      idx >>= 1;
      if (idx == 0) { break; }
      ret += node[idx];
    }
    return ret;
  }
};
int main() {
  int n, q; cin >> n >> q;
  SegmentTree<long long> seg_tree(n);
  while (q--) {
    int com; cin >> com;
    if (com == 0) {
      int s, t, x; cin >> s >> t >> x;
      seg_tree.add(s, t+1, x);
    }
    if (com == 1) {
      int i; cin >> i;
      cout << seg_tree.get(i) << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4932
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1

N= input().split() 
A=divisor(int(N[0]))

B=divisor(int(N[1]))
count=1
for i in A:
    if (i in B):
        if is_prime(i):
            count+=1

print(count)

Measured memory_bytes: 4172
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	int box[100001];
	int men[100000];
	int i;
	int x;
	long long sum;
	cin>>n;
	for(i=0;i<n+1;i++)	cin>>box[i];
	for(i=0;i<n;i++)	cin>>men[i];
	sum=0;
	for(i=0;i<n;i++){
		//cout<<men[i]<<" "<<box[i]<<" "<<box[i+1]<<endl;
		if(box[i]!=0){
			if(men[i]>box[i]){
				x=men[i]-(men[i]-box[i]);
				sum+=x;
				//cout<<"one"<<" "<<x<<endl;
				men[i]-=box[i];
				//cout<<men[i]<<endl;
				box[i]=0;
				if(box[i+1]!=0){
					if(men[i]>box[i+1]){
						x=men[i]-(men[i]-box[i+1]);
						sum+=x;
						//cout<<"two"<<" "<<x<<endl;
						men[i]-=box[i+1];
						box[i+1]=0;
					}
					else{
						x=men[i];
						sum+=x;
						//cout<<"two_back"<<" "<<x<<endl;
						box[i+1]-=men[i];
						men[i]=0;
					}
				}
			}
			else{
				x=men[i];
				sum+=x;
				//cout<<"one_back"<<" "<<x<<endl;
				box[i]-=men[i];
				men[i]=0;
			}
		}
		else{
			if(box[i+1]!=0){
				if(men[i]>box[i+1]){
					sum+=box[i+1];
					box[i+1]=0;
				}
				else{
					x=men[i];
					sum+=x;
					box[i+1]-=men[i];
				}
			}
		}
	}
	cout<<sum<<endl;
	return 0;
}

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

using namespace std;

using ui = unsigned int;

int main(void)
{
    ui N;
    cin >> N;
    vector<ui> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }

    ui all = a[0];
    for (int i = 1; i < N; i++)
    {
        all ^= a[i];
    }

    for (int i = 0; i < N; i++)
    {
        cout << (all ^ a[i]) << endl;
    }

    return 0;
}


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

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

    long m = 12;
    long w[m] = {
            1,
            6,
            9,
            36,
            81,
            216,          // 6^3
            729,          // 9^3
            1296,       // 6^4
            6561,       // 9^4
            7776,       // 6^5
            46656,    // 6^6
            59049,    // 9^5
    };
    long n;
    cin >> n;

    long dp[n + 1];
    for (long i = 0; i <= n; ++i) {
        dp[i] = n;
    }
    dp[0] = 0;

    for (long i = 0; i < m; ++i) {
        for (long j = w[i]; j <= n; ++j) {
            dp[j] = min(dp[j], dp[j - w[i]] + 1);
        }
    }

    cout << dp[n] << '\n';
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << min(a, b) + min(c, d) << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const LL MOD = 1000000007LL;
int gcd(int a, int b) {
	return b ? gcd(b, a%b) : a;
}
int A[100000];
int main() {
	int N, K;
	cin >> N >> K;
	for (int i = 0; i < N; i++) cin >> A[i];
	int M = A[0] , g = A[0];
	for (int i = 1; i < N; i++) M = max(M, A[i]), g = gcd(g, A[i]);
	if (K <= M && K%g == 0) {
		cout << "POSSIBLE" << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
using namespace std;
string s;
int main(){
  cin >> s;
  int ans=0;
  int len=s.length();
  for(int i=0;i<len;i++){
    if(s[i]=='p')ans--;
  }
  printf("%d\n",ans+len/2);
  return 0;
}


Measured memory_bytes: 512
#%%
import itertools
import time
A, B, C, D, E, F = map(int,input(). split())

st = time.time()

l = list(itertools.product(range(31), repeat=2))
water = []
for i in range(len(l)):
    tmp = 0
    tmp += 100 * A * l[i][0]
    tmp += 100 * B * l[i][1]
    if tmp <= 3000:
        water.append(tmp)
l = list(itertools.product(range(1501), repeat=2))
water = list(set(water))

sugar = []
for i in range(len(l)):
    tmp = 0
    tmp += C * l[i][0]
    tmp += D * l[i][1]
    if tmp <= 1500:
        sugar.append(tmp)
sugar = list(set(sugar))

#print(len(water))
#print(len(sugar))

ans = []
for i in water:
    for j in sugar:
        if i * E >= 100 * j and i + j <= F and i + j != 0:
            tmp = [i + j, j, j/(i+j)]
            ans.append(tmp)

ans.sort(key=lambda x:x[2])

#print(ans)

print(ans[-1][0], ans[-1][1])







ed = time.time()
#print(ed-st)

Measured memory_bytes: 185916
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <string>
#include <set>
using namespace std;

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

int x1[10],y1[10],x2[10],y2[10];
int order[10];
bool readf[10];
int cnt;
int n;

typedef pair<int,int> pii;
typedef pair<pair<int,int> ,int> piii;

void rec(set<int> se) {
  while(1) {
    set<piii> vvv;
    FOR(it,se) {                  // ツ暗ェツ氾板右ツ湘」ツづ個右ツ湘」ツづーツ探ツつキ
//      cout << *it << "";
      if (!readf[*it])
        vvv.insert(piii(pii(x1[*it],y1[*it]),*it));
//      cout <<"("<< x1[*it]<< " " <<y1[*it]<<") ";
    }
    if (vvv.size() == 0) break;
//    cout << endl;
    int now = min_element(ALL(vvv))->second;
//    cout << now << endl;
    readf[now] = 1;
    order[now] = cnt++;
    int mi = INF;
    REP(i,n) {
      if (x1[i] >= x1[now] && y1[i] < y2[now] && y2[now] < y2[i]) {
        mi = min(mi,x1[i]);
      }
    }
    set<int> next;
    REP(i,n) {
      if (!readf[i] && y2[i] <= y2[now] && mi >= x2[i] && x1[i] >= x1[now]) {
        next.insert(i);
      }
    }
    if (next.size())
      rec(next);
  }
}

int main() {
  int nnnn = 0;
  while(cin >> n, n) {
    if (nnnn)
      cout << endl;
    else
      nnnn = 1;
    REP(i,n) {
      int x,y,xx,yy;
      cin >>x>>y>>xx>>yy;
      x1[i] = min(x,xx);
      x2[i] = max(x,xx);
      y1[i] = min(y,yy);
      y2[i] = max(y,yy);
    }
    memset(readf,0,sizeof(readf));
    cnt = 0;
    set<int> se;
    REP(i,n) se.insert(i);
    rec(se);
    REP(i,n) {
      cout << order[i]+1 << endl;
    }
  }
}

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

// GCD, LCM
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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

    vector<pair<int,int>> A(N);

    for(int i=0;i<N;i++){
        cin>>a;
        A[i] = make_pair(a,i+1);
    }

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

    for(int i=0;i<N;i++){
        cout<<A[i].second;
        if(i!=(N-1))cout<<" ";
        else cout<<endl;
    }

    return 0;
}

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

#define rp(i, k, n) for (ll i = k; i < n; i++)
#define ll  long long

ll mod = 1e9 + 7;

int main() {
    string s;
    cin >> s;
    int a, b, c;
    int ans = 1000;
    rp(i, 0, s.size()-2) {
        a = s.at(i) - '0';
        b = s.at(i+1) - '0';
        c = s.at(i+2) - '0';
        if(abs(753-(a*100+b*10+c)) < ans) {
            ans = abs(753-(a*100+b*10+c));
        }
    }
    printf("%d", ans);
    return 0;
}


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

using namespace std;

int main(void){
   
   int n, k;
   cin >> n >> k;
   
   vector<int> a(n);
   for (int i = 0; i < n; i++) cin >> a[i];
   
   for (int i = 0; i < k; i++){
       
       vector<int> cumulativeSum(n+1);
       
       for (int j = 0; j < n; j++){
           int l = max(0,j-a[j]);
           int r = min(n,j+a[j] + 1);
           
           cumulativeSum[l]++;
           cumulativeSum[r]--;
        }
        
        for (int j = 0; j < n; j++) cumulativeSum[j+1] += cumulativeSum[j];
        
        cumulativeSum.pop_back();
        if (a == cumulativeSum) break;
        a = cumulativeSum;
   } 
   
   
   for (int p: a) cout << p << endl;
}


Measured memory_bytes: 4804
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>
#include <numeric>
#include <iterator>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(int i=0;i<(int)N;++i)
#define rpt(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

int main()
{
    IO;

    int n; cin >> n;
    vi a(n + 2), b(n+1);
    a[0] = 0;
    a[n + 1] = 0;

    rep(i, n) cin >> a[i + 1];

    int sum = 0;
    rep(i, n+1) sum += abs(a[i] - a[i + 1]);

    rep(i, n) b[i] = abs(a[i + 1] - a[i]) + abs(a[i + 2] - a[i + 1]) - abs(a[i] - a[i + 2]);

    rep(i, n) cout << sum - b[i] << endl;

}

Measured memory_bytes: 3952
#include<bits/stdc++.h>
using namespace std;
int n,m,k,a[100010],b[100010],x,y,z,mn1=1e9,mn2=1e9,ans;
int main(){
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		mn1=min(mn1,a[i]);
	}
	for(int i=1;i<=m;i++){
		cin>>b[i];
		mn2=min(mn2,b[i]);
	}
	ans=mn1+mn2;
	while(k--){
		cin>>x>>y>>z;
		ans=min(ans,a[x]+b[y]-z);
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

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

    int d = 0;
    std::map<int,int> snuke;
    //for(int i=0; i<=100; i++)  snuke[i] = -1;
    
    for(int i=0; i<k; i++){
        cin >> d;
        for(int j=0; j<d; j++){
            int tmp;
            cin >> tmp;
            snuke[tmp] = 0;
            //cout << tmp << endl;
        }
    }
    cout << n-snuke.size() << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(void) {
	long a;
	long b;
	long d;
	long r;
	double f;
	scanf("%ld %ld", &a, &b);
	d = a / b;
	r = a % b;
	f = (double)a / (double)b;
	printf("%ld %ld %f\n", d, r, f);
	return 0;
}

Measured memory_bytes: 632
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,q,cnt;
ll m;
int p[MAXN],r[MAXN];
void init(int n)
{
    for(int i=0;i<n;i++)
    {
        p[i]=i;
        r[i]=0;
    }
    cnt=n;
}
int find(int x)
{
    if(p[x]==x) return x;
    else return p[x]=find(p[x]);
}
void unite(int x,int y)
{
    x=find(x);
    y=find(y);
    if(x==y) return;
    cnt--;
    if(r[x]<r[y]) p[x]=y;
    else
    {
        p[y]=x;
        if(r[x]==r[y]) r[x]++;
    }
}
bool same(int x,int y)
{
    return find(x)==find(y);
}
vector<P> con;
vector<P> ncon;
int main()
{
    scanf("%d%lld%d",&n,&m,&q);
    init(n);
    for(int i=0;i<q;i++)
    {
        int x,y,z;
        scanf("%d%d%d",&x,&y,&z);
        if(!z) con.push_back(P(x,y));
        else ncon.push_back(P(x,y));
    }
    for(auto p:con) unite(p.F,p.S);
    bool f=true;
    for(auto p:ncon)
    {
        if(same(p.F,p.S)) f=false;
    }
    if(!f) {puts("No"); return 0;}
    if(m==n-1)
    {
        if(!ncon.size()) puts("Yes"); else puts("No");
    }
    else
    {
        if(m<=n+1LL*cnt*(cnt-3)/2) puts("Yes"); else puts("No");
    }
    return 0;
}


Measured memory_bytes: 2168
# 17:16 -
s = gets.to_s.chomp.bytes
t = gets.to_s.chomp.bytes

n = s.size

a = Hash.new(0)
b = Hash.new(0)

n.times do |i|
  
  if a[s[i]] != b[t[i]]
    puts "No"
    exit
  else
    a[s[i]] += 1
    b[t[i]] += 1
  end
end

puts "Yes"

Measured memory_bytes: 5824
#include<bits/stdc++.h>
using namespace std;
const int N=6;
int n,m,s[N],c[N]; 
int main()
{
    cin>>n>>m;
    for(int i=1;i<=m;i++)cin>>s[i]>>c[i];
    for(int i=0;i<1000;i++){
        string t=to_string(i);
        if(t.size()==n){
            int j;for(j=1;j<=m;j++)if(t[s[j]-1]!=c[j]+'0')break;
            if(j==m+1){cout<<i<<endl;return 0;}
        }
    }
    return cout<<-1,0;
}


Measured memory_bytes: 3604
#include<stdio.h>
int A[1000000],n;
int binarySearch(int key)
{
	int left=0;
	int right=n;
	int mid;
	while(left<right){
		mid=(left+right)/2;
		if(key==A[mid]){return 1;}
		if(key>A[mid]){left=mid+1;}
		else if(key<A[mid]){right=mid;}
		}
		return 0;
}
int main(void){
	int i,q,k,sum=0;
	scanf("%d",&n);
	for(i=0; i<n; i++){
		scanf("%d",&A[i]);
	}
	scanf("%d",&q);
	for(i=0; i<q; i++){
		scanf("%d", &k);
		if(binarySearch(k)){sum++;}
		}
		printf("%d\n",sum);
	}


Measured memory_bytes: 2248
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <bitset>
#include <cmath>
#include <string>
#include <iterator>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
int main(){
  int N;
  list<int> L;
  string S;
  int A;
  cin>>N;
  FOR(i,0,N){
    cin>>S;
    if(S=="insert"){
      cin>>A;
      L.push_front(A);
    }else if(S=="delete"){
      cin>>A;
      for(list<int>::iterator it=L.begin();it!=L.end();it++){
        if(*it!=A){
          continue;
        }else{
          L.erase(it);
          break;
        }
      }
    }else if(S=="deleteFirst"){
      L.pop_front();
    }else if(S=="deleteLast"){
      L.pop_back();
    }
  }
  for(list<int>::iterator it=L.begin();it!=L.end();it++){
    if(it!=L.begin()){
      cout<<" ";
    }
    cout<<*it;
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 34428
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;

//typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;

int main(void) {
	int sizeS,jur;
	jur=0;
	string S, T;
	cin >> S >> T;
	sizeS = S.length();
	vector<char> keep(sizeS);
	if (S == T)jur = 1;
	for (int j = 0; j < sizeS; j++) {
		for (int i = 0; i < sizeS; i++) {
			keep[i] = S[i];
			if (i == 0)S[i] = S[sizeS - 1];
			else S[i] = keep[i-1];
		
			
		}
		
		if (S == T)jur = 1;

	}
	if (jur == 1)cout << "Yes" << endl;
	else cout << "No" << endl;
}



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

int main() {
  string s, t;
  cin >> s >> t;
  bool cond = true;
  rep(i, s.size()){
    if(s[i] != t[i]){
      cond = false;
      break;
    }
  }
  cout << (cond ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

std::vector<intmax_t> divisor(intmax_t n) {
  std::vector<intmax_t> res;
  for (intmax_t i = 1; i*i <= n; ++i) {
    if (n % i == 0) {
      res.push_back(i);
      if (i != n/i)
        res.push_back(n/i);
    }
  }
  std::sort(res.begin(), res.end());
  return res;
}

int main() {
  intmax_t N, M;
  scanf("%jd %jd", &N, &M);

  auto ds = divisor(M);
  intmax_t res = 1;
  for (auto d: ds)
    if (M/d >= N) res = d;

  printf("%jd\n", res);
}


Measured memory_bytes: 632
import java.util.*;
public class Main { 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        
        if(k >= n) {
            System.out.println(0);
            return;
        }
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        long sum = 0;
        for(int i = 0; i < n - k; i++) {
            sum += arr[i];
        }
        System.out.println(sum);
    }
}

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

using namespace std;

const int N = 1e5 + 5;
const int INF = 1e9 + 7;
int n, W, w[105], v[105], dp[N], newdp[N];

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

    cin >> n >> W;
    for(int i = 1; i <= n; i++){
        cin >> w[i] >> v[i];
    }

    for(int i = 1; i <= 1e5; i++){
        dp[i] = INF;
    }
    dp[v[1]] = w[1];
    for(int i = 2; i <= n; i++){
        for(int j = 0; j <= 1e5; j++){
            newdp[j] = dp[j];
        }

        for(int j = 0; j <= 1e5 - v[i]; j++){
            if(dp[j] + w[i] <= W){
                newdp[j + v[i]] = min(newdp[j + v[i]], dp[j] + w[i]);
            }
        }

        for(int j = 0; j <= 1e5; j++){
            dp[j] = newdp[j];
        }
    }
    int ans = 1;
    for(int i = 1e5; i >= 1; i--){
        if(dp[i] <= W){
            ans = i;
            break;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 4308
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	int l=0,k=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]%2==0)
			l++;
		if(a[i]%6==0||a[i]%10==0)
			k++;
	}
	if(l==k)
		cout<<"APPROVED";
	else
		cout<<"DENIED";
	return 0;
}

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


int main() {
	int X, Y, Z;
	int K;
	cin >> X >> Y >> Z;
	cin >> K;
	vector<ll> A(X), B(Y), C(Z);

	for (int i = 0; i < X; i++) cin >> A[i];
	for (int i = 0; i < Y; i++) cin >> B[i];
	for (int i = 0; i < Z; i++) cin >> C[i];

	vector<ll> AB;
	for (int i = 0; i < X; i++)
	{
		for (int j = 0; j < Y; j++)
		{
			AB.push_back(A[i] + B[j]);
		}
	}
	sort(AB.begin(), AB.end());
	reverse(AB.begin(), AB.end());

	vector<ll> ABC;

	for (int i = 0; i < min(K, (int)AB.size()); i++)
	{
		for (int j = 0; j < Z; j++)
		{
			ABC.push_back(AB[i] + C[j]);
		}
	}

	sort(ABC.begin(), ABC.end());
	reverse(ABC.begin(), ABC.end());

	for (int i = 0; i < K; i++)
	{
		cout << ABC[i] << endl;
	}

}


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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 15, M = 1010;

int n, m, k;
int f[N][M];
char g[N][M];

bool check(int n, int l, int r)
{
	for (int i = 1; i <= n; i ++ )
		if (f[i][r] - f[i][l - 1] > k)
			return false;
	return true;
}

int main()
{
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i ++ ) cin >> g[i] + 1;
	
	int res = 0x3f3f3f3f;
	for (int t = 0; t < 1 << (n - 1); t ++ )
	{
		int cnt = 0, row = 1;
		bool flag = true;
		memset(f, 0, sizeof f);
		
		for (int i = 1; i <= n; i ++ )
		{
			for (int j = 1; j <= m; j ++ )
			{
				f[row][j] += g[i][j] - '0';
				if (f[row][j] > k)
				{
					flag = false;
					break;
				}
			}
			if ((t >> (i - 1)) & 1) row ++ , cnt ++ ;
		}
		if (!flag) continue;
		
		for (int i = 1; i <= row; i ++ )
			for (int j = 1; j <= m; j ++ )
				f[i][j] += f[i][j - 1];
		
		for (int i = 1; i <= m; i ++ )
		{
			int j = i;
			while (j <= m && check(row, i, j)) j ++ ;
			
			if (j <= m) cnt ++ ;
			i = j - 1;
		}
		res = min(res, cnt);
	}
	
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAXN 200005
ll n, p[MAXN], a[MAXN];
set<ll> s;
ll mx(ll a, ll b){
    return a > b ? a : b;
}

int main(){
    cin >> n;
    for(ll i = 0; i < n; i++){
        cin >> p[i];
        a[p[i]] = mx(a[p[i]], 1ll);
        s.insert(p[i]);
        if(s.count(p[i] - 1)){
            a[p[i]] = mx(a[p[i]], a[p[i] - 1] + 1);
        }
        //printf("a[%lld] = %lld ", p[i], a[p[i]]);
        //printf("p[%lld] = %lld\n", i, p[i]);
    }
    ll anss = 0, ansg = 0, ans = 0;
    for(ll i = 0; i < n; i++){
        if(a[ansg] < a[p[i]]){
            ansg = p[i];
            anss = p[i] - a[ansg] + 1;
        }
        //printf("g %lld s %lld a[%lld] = %lld\n", ansg, anss, p[i], a[p[i]]);
    }
    cout << anss - 1 + n - ansg << endl;

    return 0;
}
/*
9
5 2 3 6 4 7 8 9 1
*/




Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,bool> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vector<P> a;
  rep(i,n){
    int x;
    cin>>x;
    a.push_back(P(x,true));
  }
  rep(i,n){
    int x;
    cin>>x;
    a.push_back(P(x,false));
  }
  sort(begin(a),end(a));
  vector<bool> b;
  rep(i,2*n) b.push_back(a[i].se);
  ll ans=1;
  bool now=b[0];
  ll cnt=0;
  rep(i,2*n){
    if(now==b[i]){
      cnt++;
      cnt%=mod;
    }else{
      (ans*=cnt)%=mod;
      cnt--;
      if(cnt==0 && i+1<2*n) now=b[i+1];
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 6384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second

using namespace std;

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

const int INF = 100000000;


int main(){
	//freopen("test.txt", "r", stdin);
	while(1){
		int n;
		cin >> n;
		if(!n) break;

		vector<vector<int> > v(31);
		rep(i, n){
			int m;
			cin >> m;
			rep(j, m){
				int k;
				cin >> k;
				v[k].push_back(i);
			}
		}

		vector<ll> s(n); // i番目が持っている地図
		rep(i, n){
			s[i] = (ll)1<<i;
//			cout << s[i] << endl;
		}
		bool ok = false;
		for(int i = 1; i <= 30; i++){
			ll map = 0;
			for(int k = 0; k < v[i].size(); k++){
				map |= s[v[i][k]];
			}
			for(int k = 0; k < v[i].size(); k++){
				s[v[i][k]] |= map;
			}
			rep(j, n){
				if(s[j]+1 == (ll)1<<n) ok = true;
			}
			if(ok){
				cout << i << endl;
				break;
			}
		}

		if(!ok)cout << -1 << endl;

	}

	return 0;
}

Measured memory_bytes: 1232
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int helth = scan.nextInt();
        int power = scan.nextInt();
        
        if(helth%power != 0){
            System.out.println((helth/power)+1);
        }else
            System.out.println(helth/power);
    }
    
}


Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
using ll = long long;

int main() {
    int n;cin >> n;
    vector<ll> al(n), bl(n), xa,xb;
    for (auto &aal:al) cin >> aal;
    for (auto &bbl:bl) cin >> bbl;

    ll a,b,count=0;
    for (int i=0;i<n;i++) {
        if (al[i]==bl[i]) {}
        else if (al[i]>bl[i]) {
            xa.push_back(al[i]-bl[i]);
            count -= (al[i]-bl[i]);
        }
        else {
            xb.push_back(bl[i]-al[i]);
            count += (bl[i]-al[i])/2;
        }
    }
    cout << (count>=0 ? "Yes": "No" ) << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>

const int M=2e5+11;
using namespace std;
struct node{
	int l, r, ans, id;
	bool q;
}a[M*2];

int n, m, Q, num[1011];

bool cmp(node x, node y) {
	if (x.r!=y.r) return x.r<y.r;
	else return x.q<y.q;
}

bool cmp0(node x, node y) {
	if (x.q!=y.q) return x.q>y.q; 
    else return x.id<y.id;
}

inline int get() {
    int X=0,W=0; char CH=0;
    while(!isdigit(CH)) {W|=CH=='-';CH=getchar();}
    while(isdigit(CH)) X=(X<<3)+(X<<1)+(CH^48), CH=getchar();
    return W?-X:X;
}
 
int main() {
	n=get(), m=get(), Q=get();
	for (register int i=1; i<=m; i++) a[i].l=get(), a[i].r=get();
	for (register int i=m+1; i<=m+Q; i++) 
	    a[i].l=get(), a[i].r=get(), a[i].id=i, a[i].q=true;
	
	sort(a+1, a+m+Q+1, cmp);
	for (register int i=1; i<=m+Q; i++) {
		if (!a[i].q) num[a[i].l]++;
		else {
			int sum=0;
			for (int j=a[i].l; j<=a[i].r; j++) 
			    sum+=num[j];
			a[i].ans=sum;
		}
	}	
	
	sort(a+1, a+m+Q+1, cmp0);
	
	for (int i=1; i<=Q; i++) 
	    printf("%d\n", a[i].ans);
 	return 0;
}

Measured memory_bytes: 7040
import bisect
n = int(input())
s = list(input())
alp = 'abcdefghijklmnopqrstuvwxyz'
cnt = {c: [] for c in alp}

for i, c in enumerate(s):
    cnt[c].append(i)

q = int(input())
for _ in range(q):
    t, x, y = input().split()
    ans = 0
    if t == '1':
        i, c = int(x) - 1, y
        if s[i] == c:
            continue
        a = bisect.bisect_left(cnt[s[i]], i)
        cnt[s[i]].pop(a)
        s[i] = c
        b = bisect.bisect_left(cnt[c], i)
        cnt[c].insert(b, i)
    else:
        l, r = int(x) - 1, int(y) - 1
        for c in alp:
            a = bisect.bisect_left(cnt[c], l)
            if a < len(cnt[c]) and cnt[c][a] <= r:
                ans += 1

        print(ans)

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

using namespace std;

#define pb push_back
#define ull unsigned long long
#define ll long long

// LETS KEEP IT SIMPLE AND ROBUST

int solve() {

	return 0;
}


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

	while (true) {
		c-=b;
		if (c<=0) {
			printf("Yes\n");
			return 0;
		}

		a-=d;
		if (a<=0) {
			printf("No\n");
			return 0;
		}
	}
}









Measured memory_bytes: 3624
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
query = []
for i in range(M):
    b, c = map(int, input().split())
    query.append([b, c])
query.sort(key=lambda q: q[1], reverse=True)


i = 0
for b, c in query:
    while i < N and b > 0:
        if A[i] < c:
            A[i] = c
            b -= 1
        i += 1

print(sum(A))


Measured memory_bytes: 25512
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<int> C;
#define X real()
#define Y imag()
//typedef unordered_set<ll> usll;
//typedef unordered_multiset<ll> umsll;
typedef multiset<ll> msll;
typedef set<ll> sll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll> > vpll;
typedef priority_queue<ll> pqll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
//typedef unordered_multiset<int> umsi;
//typedef unordered_set<int> usi;
typedef pair<int,int> pi;
typedef vector<pair<int,int> > vpi;
typedef vector<pair<double,double> > vpd;
typedef pair<double,double> pd;
typedef priority_queue<int> pqi;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ind_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ind_setll;
#define in insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define be begin
#define en end
#define itr iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mo 1000000007
#define inf 1000000000000000001
#define ninf -1000000000000000001
#define ima INT_MAX
#define imi INT_MIN
#define oncnt __builtin_popcount
#define zerobegin __builtin_clz
#define zeroend __builtin_ctz
#define parity __builtin_parity
const ld pii=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return((a-b+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}


int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{
int n;
cin>>n;
int k=n/500;
int p=n%500;
p=p/5;
cout<<k*1000+p*5;

}return 0;}







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

int main (){
	int n=0;
	int komugiko=0;
	int donuts[200];
	cin >> n >> komugiko;


	int scanloop=0;
	int all=0;
	int minimumdonuts=10000;
	int count=n;
	
	while (scanloop<n){

		donuts[scanloop]=10000;
		cin >> donuts[scanloop];
		if(minimumdonuts>donuts[scanloop]){
			minimumdonuts=donuts[scanloop];
		}
		all=all+donuts[scanloop];
		scanloop=scanloop+1;
	}
	komugiko=komugiko-all;

	while(komugiko>=minimumdonuts){
		komugiko = komugiko - minimumdonuts;
		count = count + 1 ;
	}

	cout << count << endl;


	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int main(){
  int A[N];
  int a,v,i=0,j,k,l,count=0;

  scanf("%d",&a);
  for(i=0;i<a;i++) scanf("%d",&A[i]);
  for(i =0;i<a;i++){
    k=i;
    v = A[i];
    j=i-1;
    while(j>=0&&A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    for(k=0;k<a;k++){
      printf("%d",A[k]);
      if(k==a-1){
	printf("\n");
	break;
      }  
      printf(" ");
    }
  }
  
  return 0;
}

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

int main() {
  string S;
  cin >> S;
  int s = S.size();
  int A = 0;
  for (int i = 0; i < s; i += 2) {
    if (S.at(i) == '0') A++;
  }
  for (int i = 1; i < s; i += 2) {
    if (S.at(i) == '1') A++;
  }
  cout << min(A, s - A) << endl;
}


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

#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;



int main()
{
    int N, c = 0;
    string S;
    cin >> N >> S;
    for (int i = 0; i < N-2; i++) {
        if (S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') c++;
    }
    cout << c << endl;
    return 0;
}



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

#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 2e9
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
const double PI = acos(-1);

using namespace std;
ll A[200001];
ll B[200001];
int main(void) {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	//	freopen("input.txt", "r", stdin);
	
	ll N, M, K; cin >> N >> M >> K;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = 1; i <= M; i++) cin >> B[i];
	
	ll val = 0;
	int cnt = 0;
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		if (val + A[i] <= K) {
			val += A[i];
			cnt++;
		}
		else break;
	}
	int idx = cnt;
	int s = 1;
	for (int i = 1; i <= M; i++) {
		if (val + B[i] <= K) {
			val += B[i];
			cnt++;
			s = i+1;
		}
		else break;
	}
	ans = max(ans, cnt);

	while (idx >= 1 && s <=M) {
		val -= A[idx--];
		cnt--;
		while (val + B[s] <= K && s<=M) {
			val += B[s++];
			cnt++;
		}
		ans = max(ans, cnt);
	}
	cout << ans;
}


Measured memory_bytes: 6772
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=1e9+7;
#define N 110000

ll gcd(ll x,ll y){
    for(;y;swap(x,y))x%=y;
    return x;
}
ll a[11000];
main(){
    ll n=in();
    ll g=0;
    for(int i=n;i>=0;i--){
        a[i]=in();
        g=gcd(g,abs(a[i]));
    }
    vector<ll> ans;
    for(ll i=2;i*i<=g;i++){
        if(g%i==0){
            ans.pb(i);
            while(g%i==0){
                g/=i;
            }
        }
    }
    if(g>1)ans.pb(g);
    int prime[33000]={};
    prime[0]=prime[1]=1;
    vector<ll> v;
    rep2(i,2,n){
        if(!prime[i]){
            v.pb(i);
            for(int j=i*2;j<=23000;j+=i){
                prime[j]=1;
            }
        }
    }
    for(auto p:v){
        ll s[11000]={};
        if(a[0]%p!=0)continue;
        rep(i,n+1){
            s[i%(p-1)]+=a[i]%p;
        }
        bool flag=true;
        rep(i,p-1){
            if(s[i]%p!=0)flag=false;
        }
        if(flag&&(a[0]%p==0))ans.pb(p);
    }
    sort(ALL(ans));
    ans.erase(unique(ALL(ans)),ans.end());
    for(auto e:ans)cout<<e<<endl;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS (1e-8)
#define MOD 1000000007
#define PI 3.141592653589793
#define RMAX 4294967295
#define equals(a,b)(fabs((a)-(b))<EPS)

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef complex<double> comp;
typedef vector<complex<double>> vcomp;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef string::const_iterator State;
class ParseError {};
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;


// 最大公約数
ll gcd(ll a, ll b)
{
	if (b == 0) return a;
	else return gcd(b, a % b);
}

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

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

	int N;
	cin >> N;
	vll t(N);

	rep(i, N) {
		cin >> t[i];
	}
	ll ans = 1;
	rep(i, N) {
		ans = lcm(ans, t[i]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

typedef long double ld;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

const ll MOD = 1e9 + 7;
const int oo = 2e9;
const ld PI = acos((ld) -1);
int Getbit(ll x, int k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 2e5 + 5;

ll n, m, query;

ll a[N];

void Solve(){
    cin >> n;
    string s;
    cin >> s;
    if(n & 1){
        cout << "No";
        return;
    }
    string t = s.substr(n / 2);
    for(int i = 0; i < n / 2; i++){
        if(s[i] != t[i]){
            cout << "No";
            return;
        }
    }
    cout << "Yes";
}

int main(){
    Speed;
    int query = 1; // cin >> query;
    while(query--){
        Solve();
    }
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define fs first
#define sc second

int main(void){
    int n,m;
    cin >> n >> m;
    priority_queue<long double> q;
    long double a;
    rep(_,n){
        cin >> a;
        q.push(a);
    }
    rep(_,m){
        a = q.top();
        q.pop();
        a /= 2;
        q.push(a);
    }
    ll ans = 0;
    rep(_,n){
        a = q.top();
        q.pop();
        ans += (ll)a;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2420
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
--import Data.Array
--import Data.Array.Unboxed
import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe

f = let divRec x n = let (q,r) = divMod x n in if r==0 then divRec q n else x in (==1) . flip divRec 5 . flip divRec 3 . flip divRec 2


main = do
    ds <- getInts
    when (length ds == 2) $ do
        let [m,n] = ds in print $length $ filter f [m..n]
        main


-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
dictCompare :: [a -> a -> Ordering] -> a -> a -> Ordering
dictCompare [] _ _ = EQ
dictCompare (f:fs) x y = let c = f x y in if c==EQ then dictCompare fs x y else c
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
-- templete



Measured memory_bytes: 4140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int MAX = 1000000000;
int main(){
    ll n,k;
    cin >> n>>k;
    ll h[100000];
    ll dp[100000];
    for (ll i = 0; i < n;i++){
        cin >> h[i];
        dp[i] = MAX;
    }
    
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (int i = 2; i < n;i++){
        for (int j = max(i-k,(ll)0); j < i;j++){
            dp[i] = min(dp[i], abs(h[i] - h[j]) + dp[j]);
        }
        //cout << dp[i] << endl;
    }
    cout << dp[n-1];
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    string S;
    cin >> S;
    sort(S.begin(), S.end());
    if(S.compare("abc") == 0)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  int num = 1;
  int result = 0;
  while(num <= N){
    int counter = 0;
    int sep = 1;
    while(sep <= num){
      if(num % sep == 0) counter++;
      sep++;
    }
    if(counter == 8) result++;
    num+= 2;
  }
  cout << result << endl;
}

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

int main() {
  int N,ans;
  cin >> N;
  ans = N / 100 + N / 10 % 10 + N % 10;
  cout << ans << endl;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
int main()
{
    ll i, testcase, n, b, j  ;
    map<ll,ll>mp;
    cin >> n ;
    ll a[n];
    for(i=0; i<n; i++)
    {
        cin >> a[i];
        mp[a[i]]++;
    }
    if(mp.size()==n)
        cout << "YES";
    else
        cout << "NO";
    return 0;
}


Measured memory_bytes: 17568
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;

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

	int ans = s.length();
	for (char c = 'a'; c <= 'z'; c++) {
		int maxLen = 0;
		int cnt = 0;
		for (int i = 0; i < s.length();i++) {
			if (s[i] == c) {
				maxLen = max(maxLen, cnt);
				cnt = 0;
			}
			else {
				cnt++;
			}
		}

		maxLen = max(maxLen, cnt);

		ans = min(ans, maxLen);
	}

	cout << ans << endl;
}



Measured memory_bytes: 256
n, k = map(int, input().split())
p = list(map(int, input().split()))

tmp = 0
for i in range(k):
    tmp += 0.5 * p[i] + 0.5

ans = tmp
for i in range(1, n-k+1):
    tmp -= 0.5 * p[i-1] + 0.5
    tmp += 0.5 * p[i+k-1] + 0.5
    if ans < tmp:
        ans = tmp

print(ans)

Measured memory_bytes: 25604
from collections import deque
s = input()
d = deque()

for i in range(len(s)):
    if (s[i] == 'B' and len(d) != 0):
        d.pop()
    elif(s[i] == 'B' and len(d) == 0):
        continue
    else:
        d.append(s[i])

print(''.join(d))


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

#define SZ(x) ((int)(x).size())
#define FOR(i, j, n) for (int i(j); i < (n); ++i)
#define FORR(v, c) for (auto &v : (c))
#define F first
#define S second
#define SQ(x) (x)*(x)
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define pnl(x) cout << x << '\n'
#define pns(x) cout << x << ' '
#define read(x) cin >> x
#define read2(x,y) cin >> x >> y
#define read3(x, y, z) cin >> x >> y >> z
#define read4(a, b, c, d) cin >> a >> b >> c >> d
#define readv(v) FORR(c,v) read(c)

typedef	vector<int>	vi;
typedef vector<long long>	vl;
typedef	long long ll;

const int MAXK = 2e6;
const ll MOD = 1e9 + 7;

void solve(void)
{
	ll N, K;
	read2(N, K);
	ll sol(0);	
	for (ll i(K); i <= N+1; ++i)
	{
		ll lo = (i-1)*i/2;
		ll up = i*(N-i) + (i*(i+1))/2;
		sol = (sol + 1+up-lo)%MOD;

	}
	pnl(sol);

}

int main(void)
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	int __t(1);
	while (__t--)
		solve();
}



Measured memory_bytes: 3656
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iterator>
#include <set>
#include <functional>

using namespace std;

#define DT long long
#define forn(i,n)for(i=0;i<n;i++)
#define forc(i,c,n)for(i=c;i<=n;i++)
#define all(x) (x).begin(), (x).end()


int main() {
	ifstream fin("Text.txt");
	DT i, j, q;
	DT a=-1, b, n, m,x,y,o1=-1,o2=-1;
	cin >> n;
	vector<DT> vc(100001);
	forn(i, n) {
		cin >> a;
		vc[a]++;
	}
	b = 0;
	m = 0;
	x = 0;
	y = 0;
	forn(i, 100001) {
		if (vc[i]) {
			m++;
			if (!(vc[i] & 1)) {
				if (o1 == -1) {
					o1 = 1;
					x = 0;
				}
				else{
					if (x)
						y = 1;
					x = 0;
				}
				b++;
			}
			else {
				x++;
			}
		}
	}
	cout << m- (((b==2 || b==4) && !y) || b&1? 1:0) << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)
int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, n)
  {
    cin >> p[i];
  }
  sort(p.begin(), p.end());
  int sum = 0;
  rep(i, k)
  {
    sum += p[i];
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3640