akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

const int N = 50;
vector<int> UF=vector<int>(N);

void init() {
    for(int i=0; i<N; i++)
        UF[i]=i;
}
int root(int a) {
    if(UF[a]==a)
        return a;
    return UF[a]=root(UF[a]);
}
void unite(int a, int b) {
  a=root(a);
  b=root(b);
  if(a==b)
    return;
  UF[a]=b;
}
bool same(int a, int b) {
    return root(a)==root(b);
}

bool check(vector<ll>& x, vector<ll>& y, int i, int j, ll p, ll q) {
  return (x[i]-x[j]==p&&y[i]-y[j]==q)||(x[i]-x[j]==-p&&y[i]-y[j]==-q);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int n;
  cin>>n;
  vector<ll> x(n);
  vector<ll> y(n);
  rep(i,n)cin>>x[i]>>y[i];
  int ans=n;
  rep(i,n) {
    repeat(j,i+1,n) {
      ll p = x[i]-x[j];
      ll q = y[i]-y[j];
      //cout << "p=" << p << " q=" << q<<endl;
      init();
      rep(ii,n) {
	repeat(jj,ii+1,n) {
	  if(check(x,y,ii,jj,p,q)) {
	    unite(ii,jj);
	  }
	}
      }
      vector<int> gn(n);
      rep(ii,n)
	gn[ii]=root(ii);
      vector<int> cnt(n);
      rep(ii,n)
	cnt[gn[ii]]++;
      int tmp=0;
      rep(ii,n) {
	if(cnt[ii]>=1)
	  tmp++;
      }
      ans=min(ans,tmp);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

/**
 * stack 栈(Last In First Out LIFO)后入先出
 * push() 在栈顶添加元素
 * pop() 移除栈顶元素
 * isEmpty() 检查栈是否为空
 * isFull() 检查栈是否为满
 */
public class Main{

    public static void main(String[]args) throws IOException{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[]stringArray = br.readLine().split("\\s");
        Stack<Integer> stack = new Stack<Integer>();
        int a = 0;
        int b = 0;
        for (int i = 0; i<stringArray.length;i++){
            if (stringArray[i].equals("+"))
            {
                a = stack.pop();
                b = stack.pop();
                stack.add(b+a);
                continue;
            }
            if (stringArray[i].equals("-"))
            {
                a = stack.pop();
                b = stack.pop();
                stack.add(b-a);
                continue;
            }
            if (stringArray[i].equals("*"))
            {
                a = stack.pop();
                b = stack.pop();
                stack.add(b*a);
                continue;
            }
            if (stringArray[i].equals("/"))
            {
                a = stack.pop();
                b = stack.pop();
                stack.add(b / a);
                continue;
            }
            stack.push(Integer.parseInt(stringArray[i]));
        }
        System.out.println(stack.pop());
    }

}



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

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

  vector<int> t(N + 1), x(N + 1), y(N + 1);
  for (int i = 0; i < N; i++) {
    cin >> t[i + 1] >> x[i + 1] >> y[i + 1];
  }

  bool can_move = true;
  for (int i = 0; i < N; i++) {
    int dt = t[i + 1] - t[i];
    int dxy = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);  // 前回との移動値
    // 移動量を超えるか、偶数と奇数が一致しない場合は不可
    if (dxy > dt || dt % 2 != dxy % 2) can_move = false;
  }

  cout << (can_move ? "Yes" : "No") << endl;
}


Measured memory_bytes: 4512
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, x, t;
	cin >> n >> x>> t;
	cout << (n + x - 1) / x  * t << endl;
	return 0;
}

Measured memory_bytes: 3652
n = int(input())

def check(t, x, y):
    return (t - (abs(x) + abs(y))) >= 0 and (t - (abs(x) + abs(y))) % 2 == 0
t0, x0, y0 = 0, 0, 0
for l in [list(map(int, input().split())) for i in range(n)]:
    if not check(l[0] - t0, l[1] - x0, l[2] - y0):
        print('No')
        exit()
    t0, x0, y0 = l[0], l[1], l[2]
print('Yes')

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

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

    if (N <= 26)
    {
        N--;
        cout << (char)('a' + N) << endl;
        return 0;
    }

    unsigned long long total = 0;
    unsigned long long digit;
    for (digit = 1; digit < 20; digit++)
    {
        if (total + pow(26, digit) >= N)
        {
            N -= total;
            break;
        }
        else
        {
            total += pow(26, digit);
        }
    }
    N--;
    vector<unsigned long long> ans(digit, 0);
    for (unsigned long long i = 0; i < digit; i++)
    {
        ans[i] = N % 26;
        N /= 26;
    }
    reverse(ans.begin(), ans.end());
    for (unsigned long long a : ans)
    {
        cout << (char)('a' + a);
    }
    cout << endl;
}


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

using ll = long long;

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

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    int n; std::cin >> n;
    vi a(n+2);
    a[0] = a[n+1] = 0;
    rep(i, n) std::cin >> a[i+1];
    n += 2;
    int tot = 0;
    srep(i, 1, n) {
        tot += abs(a[i]-a[i-1]);
    }
    srep(i, 1, n-1) {
        int sub = abs(a[i]-a[i-1])+abs(a[i+1]-a[i]), add = abs(a[i-1]-a[i+1]);
        std::cout << tot-sub+add << "\n";
    }
}


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

#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

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

using PII = pair<int, int>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

int a, b;

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cin >> a; cin >> b;
    int ans = 0;
    REP(i, 2) {
        if(a > b) {
            ans += a; a--;
        } else {
            ans += b; b--;
        }
    }
    cout << ans << "\n";
}

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

long long f(long long a, long long b)
{
	if(a > b) swap(a, b);
	long long d = b / a;
	if(b % a == 0)
		return (2*d - 1) * a;
	return d * 2 * a + f(a, b % a);
}
long long n, x;
int main()
{
	cin >> n >> x;
	cout << n + f(x, n - x) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const unsigned int M = 1000000007;
int main(){
 int a;
 cin >> a;
 vector<int> b(a);
 long long  ans = 0;
 for(int i = 0;i<a;i++){
     cin >> b[i];
 }
int maxnum =0;
for(int i= 0;i<a;i++){
    maxnum = max(maxnum,b[i]);
    int ai = maxnum;
    ans+=ai-b[i];
}
cout << ans << endl;

 return 0;
}

Measured memory_bytes: 3956
#include <iostream>

int main()
{
	int S;
	int h, m, s;

	std::cin >> S;

	 h = S / 3600;
	 m = S % 3600 / 60;
	 s = S % 3600 % 60;

	std::cin >> h, m, s;

	std::cout << h << ":" << m << ":" << s << std::endl;
    return 0;
}

Measured memory_bytes: 3116
from collections import defaultdict
N, M = map(int, input().split())

aced = [False]*N
D = defaultdict(int)
ac = 0
pena = 0
for _ in range(M):
    id, judge = input().split()
    id = int(id)-1
    if judge == "WA":
        D[id] += 1
    else:
        if not aced[id]:
            aced[id] = True
            ac += 1
            pena += D[id]
print(ac, pena)


Measured memory_bytes: 16216
#include <iostream>
#include <string>
#include <vector>

int main()
{
  int D;
  std::cin >> D;

  std::string eve_data = D == 24 ? "Eve" : (D == 23 ? "Eve Eve" : (D == 22 ? "Eve Eve Eve" : "")); 
  std::cout << "Christmas " << eve_data << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdlib>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    int n,count=0;
    cin>>n;
    vector<int> l(n);
    rep(i,n){
        cin>>l[i];
    }
    rep(i,n){
        rep(k,n){
            rep(j,n){
                if(l[i]!=l[k]&&l[i]!=l[j]&&l[k]!=l[j]){
                    if(abs(l[i]-l[k])<l[j]&&l[j]<l[i]+l[k]){
                        if(i<j&&j<k){
                            
                            count++;
                        }
                    }
                }
            }
        }
    }
    cout<<count;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(){
    int a, b, c, t;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if(a > b){
        t = a;
        a = b;
        b = t;
    }
    
    if(b > c){
        t = b;
        b = c;
        c = t;
    }
    
    if(a > b){
        t = a;
        a = b;
        b = t;
    }
    
    printf("%d %d %d\n", a, b, c);
    
    return 0;
}

Measured memory_bytes: 596
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1000000007
#define INFLL 1000000000000000007LL
#define SIZE 200105
#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()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
ll dp[114514]={0};
ll sum[114514]={0};

int R,G,B,N;

int main(){
	cin>>R>>G>>B>>N;
	ll ans=0;
	for(int x=0;x<=N/R;x++){
		int temp=N-x*R;
		for(int y=0;y<=temp/G;y++){
			if((temp-y*G)%B==0)ans++;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
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 upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;


/*aのb進数時の桁数*/
ll digits(ll a, ll b){return a/b?1+digits(a/b,b):1;}
/*nをa進数にしたときの、i桁目の数*/
ll placenai(ll n, ll a, ll i){return i==1?n%a:placenai(n/a,a,i-1);}
/*aのn乗(mod)*/
ll modpow(ll a, ll n, ll mod){
    ll i,s[digits(n,2)],ans=1;
    for(i=0;i<digits(n,2);i++){
        s[i]= i==0 ? a : s[i-1]*s[i-1]%mod ;
        ans*=placenai(n,2,i+1)==1?s[i]:1; ans%=mod;}
    return n==0?1:ans;}

int main(void){
    // char ;
    ll n,ans=0;
    scanf("%lld",&n);
    ll a[n];
    rep(i,0,n){
        scanf("%lld",&a[i]);
    }
    sortup(a,n);
    if(a[0]==0){
        rep(i,1,n){
            if(a[i]!=(i+1)/2*2){
                printf("0\n");
                return 0;
            }
        }
    }else{
        rep(i,0,n){
            if(a[i]!=i/2*2+1){
                printf("0\n");
                return 0;
            }
        }
    }
    ans=modpow(2,n/2,MOD1);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int H = sc.nextInt();
		int M = sc.nextInt();
		double C = 0;
		double m = M*6;
		double h = H*30 + m/12;
		sc.close();

		double k = Math.abs(h-m);

		double K = Math.cos(Math.toRadians(k));

		C = Math.sqrt(Math.pow(A, 2) + Math.pow(B, 2) - 2*A*B*K);

		System.out.println(C);
	}

}

Measured memory_bytes: 35976
#include<bits/stdc++.h>
#define  ll  long long int
#define  sz  200010

using namespace std;

int main()
{

    ll l,r,m,a,b,x,y,c;

    cin>>a>>b;
    l=0,r=1000000;
    ll an=1000000000;
    ll f=0;


    while(l<=r)
    {
        m=(l+r)/2;

        x=m*0.08;
        y=m*0.1;
        if(x==a && y==b)
        {
            an=min(an,m);
            r=m-1;
            f=1;
        }
        else if(x>a)
        {
            r=m-1;
        }
        else if(x<a)
        {
            l=m+1;
        }
        else if(x==a)
        {
            if(y>b)
            {
                r=m-1;
            }
            else if(y<b)
            {
                l=m+1;
            }
        }
    }

    if(f==0)cout<<-1<<endl;
    else
        cout<<an<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <algorithm>
#include <vector>
#include <cmath>

bool isPrime(int64_t x) {
  if (x % 2 == 0) return false;
  for (int64_t i = 3; i * i <= x; i+=2) {
    if (x % i == 0) return false;
  }
  return true;
}

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

  int64_t X;
  std::cin >> X;
  int64_t n = X;
  if (n == 2) {
    std::cout << 2 << std::endl;
    return 0;
  }
  while (1) {
    if(isPrime(n)){
      std::cout << n << std::endl;
      break;
    }
    n++;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] ary = String.valueOf(n).toCharArray();
		int h = 0;
		for (char c : ary) {
			h += Character.getNumericValue(c);
		}
		System.out.println(n%h == 0 ? "Yes":"No");
	}
}


Measured memory_bytes: 21332
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#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 <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#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 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class e {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int n;
        cin >> n;

        if (n % 2 == 1) {
            cout << 0 << endl;
            return;
        }

        int cur = 5;
        int five = 0;
        while (cur <= n) {
            five += n / cur / 2;
            cur *= 5;
        }
        cout << five << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    e solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
from collections import deque

n = int(input())
q = deque(['3','5','7'])
ans = 0
l = []
while True:
    v = q.popleft()
    if int(v) >= n:
        if int(v) == n and ('3' in v and '5' in v and '7' in v):
            ans += 1
        print(ans)
        exit() 
    if '3' in v and '5' in v and '7' in v:
        ans += 1
        l.append(int(v))
    q.append(v+'3')
    q.append(v+'5')
    q.append(v+'7')

Measured memory_bytes: 8684
#include <iostream>
#include <string>
using namespace std;
int main(){
  int N,A,B;
  int count_a=0,count_b=0;
  string s;
  cin >> N >> A >> B;
  cin >> s;
  for(int i=0;i<N;i++){
    if(s[i] == 'a'){
      if(count_a + count_b < A+B){
        cout << "Yes" << endl;
        count_a++;
      }else{
        cout << "No" << endl;
      }
    }else if(s[i] == 'b'){
      if(count_a+count_b < A+B && count_b < B){
        cout << "Yes" << endl;
        count_b++;
      }else{
        cout << "No" << endl;
      }
    }else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 3744
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

int N, cnt;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> N;
	for (int i = 1; i <= N; ++i)
		cnt += i & 1;
	cout << fixed << setprecision(8);
	cout << 1.0 * cnt / N;
}

Measured memory_bytes: 256
n,m,c=gets.chomp.split(" ").map(&:to_i);

b=gets.chomp.split(" ").map(&:to_i);

a=[]

1.upto(n) do |i|
  a[i]=gets.chomp.split(" ").map(&:to_i);
end

answer = 0

def func1 b,a,c

  sum = 0
  b.each_with_index do |b1,i|
    sum+=b1*a[i]
  end
  sum += c
end

1.upto(n) do |i|
  if func1(b,a[i],c) > 0 
    answer+=1
  end
end


print answer


Measured memory_bytes: 14264
// KOI NI YAAR SAB SAHI HOEGA  BAS  CHORRO MAT
// ENJOR KARO YAAR
// HAAR MAT MAANO
// // APNA TIME AAYEGA
// BEILIEVE IN GOD
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define loopb(i,a,b) for (lli i=a;i>=b;i--)
#define pb push_back
#define mod 1000000007
#define fast() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define gcd(a,b) (__gcd((a),(b)))
#define lcm(a,b)(((a)*(b))/gcd((a),(b)))
#define ma 1e18
#define bc __builtin_popcountll
#define vi vector<lli>
#define pr pair<lli,lli>
#define vp vector<pr>
#define F  first
#define S   second
#define lld long double
#define PI  3.14159265358979
#define pri  priority_queue<ll>
#define prim  priority_queue<ll,vector<ll>,greater<ll>>
#define flush  cout<<flush

const lli  N=3e3+10;
 
vector<vector<lld>> dp(N,vector<lld>(N,-1)); 
lli n;
lld a[3000];
lli ans;



double solve(lli index , lli tails)
{if(index == n+1)
{if(tails<=n/2)
{return 1.0;
}
else
{return 0.0;
}
}
if(dp[index][tails]!=-1)
{return dp[index][tails];
}
return dp[index][tails] =  ((a[index] * 1.0 * solve(index+1,tails)) + (1.0-a[index]) * 1.0 *  solve(index+1,tails+1));
}

int main()
{
cin>>n;
loop(i,1,n+1)
{cin>>a[i];
}
cout<<fixed<<setprecision(10)<<solve(1,0)<<"\n";
}


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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define inf 1000000100

int main()
{
    string s;
    cin >> s;
    for(int i = 0; s[i]; i++)
    {
        if(s[i] == ',')
           {
               s[i] = ' ';
           }
    }
    cout << s << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
const ll MODA=998244353;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        swap(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
vector<ll> find_divisor(ll N){
  ll k=1;
  while(k*k<=N){
    k++;
  }
  vector<ll> A(1);
  rep(i,k){
    if(i==1)A.at(0)=1;
    else if(i>=2){
      if(N%i==0)A.push_back(i);
    }
  }
  ll t=0;
  t=A.size();
  rep(i,t){
    if(A.at(t-i-1)*A.at(t-i-1)!=N)A.push_back(N/A.at(t-1-i));
  }
  return A;
}
vector<ll> fac;
vector<ll> finv;
vector<ll> inv;
void COMinit(ll N,ll P){
    rep(i,N+1){
        if(i==0){
            fac.push_back(1);
            finv.push_back(1);
            inv.push_back(1);
        }
        else if(i==1){
            fac.push_back(1);
            finv.push_back(1);
            inv.push_back(1);
        }
        else{
            fac.push_back(fac.at(i-1)*i%P);
            inv.push_back(P-inv.at(P%i)*(P/i)%P);
            finv.push_back(finv.at(i-1)*inv.at(i)%P);
        }
    }
}

ll COM(ll n,ll k,ll P){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return fac.at(n)*(finv.at(k)*finv.at(n-k)%P)%P;
}
int main()
{
    ll N,sum;
    sum=0;
    cin>>N;
    vector<ll>A(N+1);
    rep(i,N+1){
        ll a;
        cin>>a;
        sum+=a;
        A.at(i)=a;
    }
    sum--;
    bool TF=true;
    vector<ll>B(N+1);
    ll ans=0;
    if(sum<0)cout<<-1<<endl;
    else{
        rep(i,N+1){
            if(i==0){
                B.at(i)=1;
                if(A.at(i)>=2)TF=false;
            }
            if(i>=1){
                B.at(i)=B.at(i-1)-A.at(i-1)+min(B.at(i-1)-A.at(i-1),sum);
                sum-=min(B.at(i-1)-A.at(i-1),sum);
                ans+=B.at(i);
                if(B.at(i-1)<=A.at(i-1))TF=false;
            }
        }
        if(A.at(N)>B.at(N))TF=false;
        if(TF)cout<<ans+1<<endl;
        else cout<<-1<<endl;
    }   
}

Measured memory_bytes: 4808
from collections import deque
    
N,M = list(map(int,input().split()))

node_list = [[] for i in range(N)]

for i in range(M):
    x,y,z=list(map(int,input().split()))
    node_list[x-1].append(y-1)
    node_list[y-1].append(x-1)

checked_list = [-1 for i in range(N)]

def BFS(start,color,checked_list,node_list):
    Q=deque([start])
    checked_list[start]=color
    while len(Q)>0:
        v1 = Q.pop()
        for v2 in node_list[v1]:
            if checked_list[v2]==-1:
                checked_list[v2]=color
                Q.appendleft(v2)


count = 0
for i in range(N):
    if checked_list[i]==-1:
        BFS(i,count,checked_list,node_list)
        count+=1
        
print(count)

Measured memory_bytes: 27864
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define MAX (1000000000+7)
int main(int argc, char*argv[])
{
	
	vector<string> a;
	int H, W;

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> H >> W;
	vector<vector<unsigned int>> dp(H, vector<unsigned int>(W));
	a.reserve(H);
	
	for (int i = 0; i< H; i++)
	{
		string s;
		cin >> s;
		a.push_back(s);
	}
	dp[0][0] = 1;
	for (int i = 0; i< H;i++)
		for (int j =0; j < W; j++)
		{
			if(a[i][j]=='#')
				continue;
			if( j-1 >= 0 ) dp[i][j] += dp[i][j-1]%MAX;
			if( i-1 >= 0 ) dp[i][j] += dp[i-1][j]%MAX;
		}
	
	cout <<dp[H-1][W-1]%MAX;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  map<int,int> b;
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    int c=a.at(i)/400;
    if(c>7)
      c=8;
    b[c]++;
  }
  if(b.count(8)){
    if(b.size()==1)
      cout << 1 << " " << n << endl;
    else
      cout << b.size()-1 << " " << b.size()-1+b[8] << endl;
  }
  else
    cout << b.size() << " " << b.size() << endl;
}
         




Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars,
        t: Chars,
    }

    let mut ans = 0;

    for i in 0..s.len() {
        if s[i] != t[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 3932
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#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)
using namespace std;
using ll = long long;

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

	int N;
	cin>>N;
	vector<int> S(N);
	rep(i,0,N) cin>>S[i];
	
	ll res=0;
	rep(d,1,N-1) {
		ll sum=0;
		set<int> was;
		for (int k=1; k*d<N-1; k++) {
			sum+=S[k*d]+S[N-1-k*d];
			if (was.count(k*d)) break;
			was.insert(k*d);
			if (was.count(N-1-k*d)) break;
			was.insert(N-1-k*d);
			
			int A=N-1-k*d;
			int B=A-d;
			if (B>0 && A>=B) res=max(res,sum);
		}
	}

	cout<<res<<"\n";
}


Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const double pi = acos(-1);
const double eps = 1e-10;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
double a[MAXN];
int main() {
	int n, l; read(n), read(l);
	for (int i = 1; i <= n; i++)
		read(a[i]);
	double ansx = 0, ansy = 0;
	for (int i = 1; i <= n; i++)
	for (int j = i + 1; j <= n; j++) {
		ansx += cos(pi * (a[i] + a[j]) / l) * (n - (j - i + 1));
		ansy += sin(pi * (a[i] + a[j]) / l) * (n - (j - i + 1));
		ansx += cos(pi * (a[i] + a[j] + l) / l) * (j - i - 1);
		ansy += sin(pi * (a[i] + a[j] + l) / l) * (j - i - 1);
	}
	double cnt = 1.0 * n * (n - 1) * (n - 2) / 6;
	printf("%.10lf %.10lf\n", ansx / cnt, ansy / cnt);
	return 0;
}

Measured memory_bytes: 4144
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<set>
#include<queue>
#include<string>
#include<sstream>
#include<iostream>
#include<sstream>
#include<stack>
#include<map>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<cstdio>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define maxn 210

int n, m,t;
int a, b, c;
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		int ans = 0;
		t = i;
		while (t)
		{
			t /= 10;
			ans++;
		}
		if (ans % 2)m++;
	}
	printf("%d", m);
}

Measured memory_bytes: 256
k, n = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
ans = a[-1] - a[0]
(1..n-1).each do |i|
    sa = (a[i-1] + k) - a[i]
     ans = [ans,sa].min
end
puts ans

Measured memory_bytes: 22660
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <string>
#include <unordered_map>
using namespace std;


int main() {

    int N;
    cin >> N;

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

    unordered_map<int, int> numbers;
    for (int i = 0; i < N; i++){
        numbers[A[i]]++;
    }

    string answer = "YES";
    for (auto number: numbers){
        if(number.second > 1) {
            answer = "NO";
            break;
        }
    }

    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 9288
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {
    private static final StringBuilder builder = new StringBuilder();
    public static void main(String[] args) {
        int k = readInt();
        int n = 7;
        for (int i = 0; i < 1000000; i++) {
            if (n % k == 0) {
                System.out.print(i + 1);
                return;
            }

            n = (n % k) * 10 + 7;
        }

        System.out.print(-1);

    }

    private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    }

    private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    }

    private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    }

    private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    }

    private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    }

    private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    }

    private static double readDouble() {
        read();
        return Double.parseDouble(builder.toString());
    }

    private static BigDecimal readBigDecimal() {
        read();
        return new BigDecimal(builder.toString());
    }

    private static float readFloat() {
        read();
        return Float.parseFloat(builder.toString());
    }

    private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    }

}


Measured memory_bytes: 32020
#include <bits/stdc++.h>
typedef long long ll; 
 
using namespace std;
using P = pair<int, int>;

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<int>> v(1e5 + 1);
	vector<P> q(M);
	for (int i = 0; i < M; ++i) {
		int p, y;
		cin >> p >> y;
		q[i] = P(p, y);
		v[p].push_back(y);
	}

	for (int i = 0; i < v.size(); ++i) {
		sort(v[i].begin(), v[i].end());
	}

	for (int i = 0; i < M; ++i) {
		int p = q[i].first;
		string s1 = to_string(q[i].first);
		int size1 = s1.size();
		for (int i = 0; i < 6 - size1; ++i) { cout << 0; }
		cout << s1;

		int n = lower_bound(v[p].begin(), v[p].end(), q[i].second) - v[p].begin();
		++n;
		string s2 = to_string(n);
		int size2 = s2.size();
		for (int i = 0; i < 6 - size2; ++i) { cout << 0; }
		cout << s2;

		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 7808
#include <cstdio>

int n,q;
int s[100001];

int search(int key){
	int l=0,r=n;
	while(r-l>1){
		int mid=(l+r)/2;
		if(s[mid]>key)r=mid;
		else l=mid;
	}
	return s[l]==key?1:0;
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&s[i]);
	}
	scanf("%d",&q);
	int cnt=0;
	for(int i=0;i<q;i++){
		int t;
		scanf("%d",&t);
		cnt+=search(t);
	}
	printf("%d\n",cnt);
	return 0;
}



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

int main()
{
	int n;
	int debt = 100000;
	cin >> n;
	for (int i = 0; i < n; i++){
		debt = debt * 1.05;
		if (debt % 1000 > 0)
			debt = debt / 1000 * 1000 + 1000;
	}
	cout << debt << endl;
	return 0;
}

Measured memory_bytes: 1160
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

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

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}



template<lint mod>
struct Int_{
  unsigned x;
  unsigned mpow(Int_ a,unsigned k){
    Int_ res=1;
    while(k){
      if(k&1) res=res*a;
      a=a*a;
      k>>=1;
    }
    return res.x;
  }
  unsigned inverse(Int_ a){
    return mpow(a,mod-2);
  }
  Int_(): x(0) { }
  Int_(long long sig) {
    int sigt=sig%mod;
    if(sigt<0) sigt+=mod;
    x=sigt;
  }
  unsigned get() const { return (unsigned)x; }
  
  Int_ &operator+=(Int_ that) { if((x += that.x) >= mod) x -= mod; return *this; }
  Int_ &operator-=(Int_ that) { if((x += mod - that.x) >= mod) x -= mod; return *this; }
  Int_ &operator*=(Int_ that) { x = (unsigned long long)x * that.x % mod; return *this; }
  Int_ &operator=(Int_ that) { x=that.x; return *this;}
  Int_ &operator/=(Int_ that) { x=(unsigned long long) x * inverse(that.x)%mod; return *this;}
  bool operator==(Int_ that) const { return x==that.x; }
  bool operator!=(Int_ that) const { return x!=that.x; }

  Int_ operator-() const { return Int_(0)-Int_(*this);}
  Int_ operator+(Int_ that) const { return Int_(*this) += that; }
  Int_ operator-(Int_ that) const { return Int_(*this) -= that; }
  Int_ operator*(Int_ that) const { return Int_(*this) *= that; }
  Int_ operator/(Int_ that) const { return Int_(*this) /= that; }

};

namespace std{
  template<lint mod>
  ostream &operator <<(ostream& out,const Int_<mod>& a){
    out<<a.get();
    return out;
  }
  template<lint mod>
  istream &operator >>(istream& in,Int_<mod>& a){
    in>>a.x;
    return in;
  }
};

typedef Int_<1000000007> Int;
//const int INF=5e8;
int n,a,b,c;
Int Co[5005][5005];
Int fact[5005],invf[5005];
int main(){
  cin>>n>>a>>b>>c;

  fact[0]=invf[0]=1;
  Int one=1;
  REP(i,5002){
    fact[i+1]=fact[i]*(i+1);
    invf[i+1]=one/fact[i+1];
    Co[i][0]=1;
    REP(j,i) Co[i][j+1]=Co[i-1][j+1]+Co[i-1][j];
  }

  if(b&1){
    puts("0");
    return 0;
  }
  Int res=0;
  REP(i,min(a,c)+1) REP(j,c+1){
    if((c-i-j)%3 || (c-i-j)<0) continue;
    if(b==0 && j>0) continue;

    int A=a-i;
    int B=i;
    int C=(c-i-j)/3;
    int D=b/2;

    Int tmp=fact[A+B+C+D]*invf[A]*invf[B]*invf[C]*invf[D];
    if(b>0) tmp*=Co[j+D-1][j];
    res+=tmp;
  }
  cout<<res<<endl;
  return 0;
}





Measured memory_bytes: 98176
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

DEBUG = False

A, B = map(int, input().split())
g = gcd(A, B)
if DEBUG:
    print("gcd(A, B): {}".format(g))

ans = [1]
i= 2
temp = g
while i <= int(-(-g**0.5//1))+1:
    if DEBUG:
        print("i: {}, g: {}".format(i, g))

    if temp % i == 0:
        if DEBUG:
            print("This is a cd of A and B.")
        ans.append(i)

    while temp % i == 0:
        temp //= i

    i += 1

if temp != 1:
    ans.append(temp)

if DEBUG:
    print(ans)

print(len(ans))


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

bool used[200010];
map<int,int> mp;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (!used[a-1]) {
      used[a] = 1;
      mp[a] = 1;
    } else {
      mp[a] = mp[a-1]+1;
      used[a] = 1;
    }
  }
  int ans = 0;
  for (auto p: mp) {
    ans = max(ans, p.second);
  }
  cout << n - ans << endl;
  return 0;
}


Measured memory_bytes: 9856
import std.stdio, std.math, std.algorithm, std.array, std.string, std.conv, std.container, std.range;
T Read(T)() { return readln.chomp.to!(T); }
T[] Reads(T)() { return readln.split.to!(T[]); }
alias read = Read!(int);
alias reads = Reads!(int);

void main() {
    int a, b;
    readf("%d %d\n",&a, &b);
    if (a < b) swap(a, b);
    writeln(a + max(a-1, b));
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d", $n);
$p = explode(" ", trim(fgets(STDIN)));
$ans = 0;
for ($i = 1; $i < $n - 1; $i++) if ($p[$i - 1] < $p[$i] && $p[$i] < $p[$i + 1] || $p[$i - 1] > $p[$i] && $p[$i] > $p[$i + 1]) $ans++;
echo $ans;
?>

Measured memory_bytes: 4604
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int n=stdIn.nextInt();
		int A[]=new int[26];
		int z=0,y=0;
		while(z<n){
			String a=stdIn.next();
			int G[]=new int[26];
			while(y<a.length()){
				char b=a.charAt(y);
				G[b-'a']++;
				y++;
			}y=0;
			while(y<26) {
				if(z==0||A[y]>G[y])
					A[y]=G[y];
				G[y]=0;
				y++;
			}y=0;
			z++;
		}z=0;
		while(z<26) {
			while(y<A[z]) {
				System.out.print((char)(z+97));
				y++;
			}y=0;
			z++;
		}
		System.out.println();
	}
}

Measured memory_bytes: 23636
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		string S; cin >> S;
		string T = "_";
		rep(i, S.size()) {
			if (S[i] + T.back() == '0' + '1') T.pop_back();
			else T.push_back(S[i]);
		}
		cout << (S.size() - (T.size() - 1)) << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
//#include "/Users/student/Documents/Sublime/stdc++.h"

using namespace std;

int main() {
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    string s;
    cin >> s;
    if(n%2 == 1){
        cout << "No";
        return 0;
    }
    for(int i = 0, j = (n/2); j < n; i++, j++){
        if(s[i] != s[j]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}



Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int n, max = 0, contador = 0;
    scanf("%d", &n);
    int h[n];
    for(int i = 0;i < n; ++i){
        scanf("%d", &h[i]);
        if (i != 0){
            if (h[i-1] >= h[i]){
                ++contador;
            } else {
                if (contador > max) { 
                    max = contador;
                }
                contador = 0;
            }
        }
    } if (max < contador) {
         max = contador;
    }
    printf("%d", max);
    return 0;
}


Measured memory_bytes: 512
#!/usr/bin/env python
# -*- coding: utf-8 -*-

IN = 'sample-1.in'  # sample case for local test
def local_test():
    try:
        from pcm.utils import set_stdin
        import sys
        import os
        if len(sys.argv) == 1:
            set_stdin(os.path.dirname(__file__) + '/test/' + IN)
    except:
        pass


import sys
import os
import time
import re
from pydoc import help
import string
import math
import numpy as np
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]


def solve():
    N = int(input())
    A = list(map(int, input().split()))

    CS = [0]*(N+1)

    for n in range(N):
        if n >= 1:
            CS[n+1] = CS[n] + A[n]
        else:
            CS[n+1] = A[n]

    res = 0
    for v in Counter(CS).values():
        if v >= 2:
            res += v*(v-1)//2

    print(res)

if __name__ == "__main__":
    local_test()
    solve()




Measured memory_bytes: 52860
<?php
    fscanf(STDIN,"%d%d",$N,$K);
    
    //ある面が出る確率は1/$N
    //3面で考えると1が出る確率は1/3
    //それが10を超えるためには
    //1 2 4 8 16 で4回1/2に勝つ必要がある。
    //それぞれの面で勝つ確率を全て足していけばよい
    //倍々に点数は増えるので全部足してくのでも間に合う
    $sum=0;
    for($i=1;$i<=$N;$i++){
        //出目$iで勝つ確率を出す。
        $count=0;//何回勝つ必要があるか
        $point=$i;
        while($point<$K){
            $point = $point*2;
            $count++;
        }
        // echo $count."\n";
        
        $probability = 1/(2**$count);
        
        // echo $probability."\n";
        // echo (1/$N)*$probability."\n";
        
        $sum += (1/$N)*$probability;

    }
    echo $sum;

    
?>

Measured memory_bytes: 16020
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String s = sc.next();
    
    int oddOk = 0;
    int oddCount = 0;
    int evenOk = 0;
    int evenCount = 0;
    
    //奇数
    for(int i = 0; i < s.length(); i += 2) {
      if (s.substring(i, i + 1).equals("R") ||
          s.substring(i, i + 1).equals("U") ||
          s.substring(i, i + 1).equals("D"))
      {
		oddCount ++;
        oddOk ++;
      } else {
        oddCount ++;
      }
    }
    
    //偶数
    for(int i = 1; i < s.length(); i += 2) {
      if (s.substring(i, i + 1).equals("L") ||
          s.substring(i, i + 1).equals("U") ||
          s.substring(i, i + 1).equals("D"))
      {
        evenCount ++;
        evenOk ++;
      } else {
        evenCount ++;
      }
    }
    
    //判定
    if (oddCount == oddOk && evenCount == evenOk) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#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 rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int n;

int main() {
    cin >> n;
    ll ans = 0;
    reps(i, 1000000) reps(j, 1000000) {
        if ((ll)i * (ll)j < n) {
            ans++;
        } else {
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
	int n,x;
	refrain:
	cin>>n;
	cin>>x;
	if(n==0&&x==0) return 0;
	int count=0;
	for(int i=1;i<=n-2;i++){
		for(int j=i+1;j<=n-1;j++){
			for(int k=j+1;k<=n;k++){
				if(i+j+k==x) count++;
			}
		}
	}
	cout<<count<<endl;
	goto refrain;
}

Measured memory_bytes: 1160
n=int(input())
tmp = 1
dat = list(map(int, input().split(" ")))
#print(dat, (0 in dat))
over = False
if 0 in dat:
    print ("0")
else:
    for d in dat:
        tmp *= d
        if tmp > 1000000000000000000:
            print ("-1")
            over = True
            break
    if not over:
        print (tmp)

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

using namespace std;

vector<int> AdjList[200015];

bool visited[200015];

int main(){
	int N;
	scanf("%d", &N);
	for(int i = 0; i < N; i ++){
		int x, y;
		scanf("%d%d", &x, &y);
		AdjList[x].push_back(100005+y);
		AdjList[100005+y].push_back(x);
	}
	
	memset(visited, 0, sizeof(visited));
	long long ans = 0;
	for(int i = 0; i < 200015; i ++){
		if(!visited[i]){
			visited[i] = 1;
			long long X = 0;
			long long Y = 0;
			
			long long edges = AdjList[i].size();
			if(i < 100003){
				X ++;
			}else{
				Y ++;
			}
			queue<int> q;
			q.push(i);
			while(!q.empty()){
				int u = q.front(); q.pop();
				for(int v: AdjList[u]){
					if(!visited[v]){
						visited[v] = 1;
						q.push(v);
						edges += AdjList[v].size();
						if(v < 100003){
							X ++;
						}else{
							Y ++;
						}
					}
				}
			}
			ans += X*Y-(edges/2);
			//printf("%lld %lld %lld\n", X, Y, edges/2);
		}
	}
	printf("%lld", ans);
}


Measured memory_bytes: 8320
#include <iostream>
#include <cstdio>
#include <math.h>

using namespace std;

typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
const int MOD = 1000000007;
const int INF = INT_MAX;



int main(int argc, char const *argv[])
{
    
    
    ll n, k;
    cin >> n >> k;
    ll h[n];
    for (int i=0; i < n; i++){
        cin >> h[i];
    }

    sort(h, h + n, greater<int>());

    ll sum = 0;
    for (int i=k; i < n; i++){
        sum += h[i];
    }

    cout << sum << endl;

    



    return 0;
}




//              g++ -std=c++1z  

Measured memory_bytes: 1792
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val h = sc.nextInt()
    val w = sc.nextInt()
    val t = (1..h).map { sc.next() }
    val dx = arrayOf(0, -1, 1, 0)
    val dy = arrayOf(-1, 0, 0, 1)
    for (i in 0 until h) {
        for (j in 0 until w) {
            if (t[i][j] == '.') {
                continue
            }
            var yes = false
            for (k in 0 until 4) {
                val nx = j + dx[k]
                val ny = i + dy[k]
                if (nx in 0 until w && ny in 0 until h && t[ny][nx] == '#') {
                    yes = true
                    break
                }
            }
            if (!yes) {
                println("No")
                return
            }
        }
    }
    println("Yes")
}

Measured memory_bytes: 29604