akhauriyash/Code-Regression huggingface dataset:
//あらためて見るとこの問題全然わからない

//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	int a[2][200000], b[2][200000];
	int kazuA[29] = {}, kazuB[29] = {};
	rep(i, N) {
		a[0][i] = getint(); 
		rep(j, 28) kazuA[j] += a[0][i] >> j & 1;
	}
	rep(i, N) {
		b[0][i] = getint();
		rep(j, 28) kazuB[j] += b[0][i] >> j & 1;
	}
	int kotae = 0;
	rep(i, 28) {
		int p = i & 1;
		auto Amae = a[p];
		auto Bmae = b[p];
		auto Atugi = a[!p];
		auto Btugi = b[!p];

		int kazu[2];
		kazu[0] = 0;
		kazu[1] = N - kazuA[i];
		rep(j, N) Atugi[kazu[Amae[j] >> i & 1]++] = Amae[j];
		kazu[0] = 0;
		kazu[1] = N - kazuB[i];
		rep(j, N) Btugi[kazu[Bmae[j] >> i & 1]++] = Bmae[j];

		int kari = 0;
		int d = (1 << i) - 1;
		int d2 = 1 << i;
		int k1 = kazu[0];
		int k2 = N;
		rep(j, N - kazuA[i]) {
			while (k1 > 0 && (Atugi[j] & d) + (Btugi[k1 - 1] & d) >= d2) k1--;
			while (k2 > kazu[0] && (Atugi[j] & d) + (Btugi[k2 - 1] & d) >= d2) k2--;
			kari ^= k1 ^ k2;
		}
		k1 = kazu[0];
		k2 = N;
		for (int j = N - kazuA[i]; j < N; j++) {
			while (k1 > 0 && (Atugi[j] & d) + (Btugi[k1 - 1] & d) >= d2) k1--;
			while (k2 > kazu[0] && (Atugi[j] & d) + (Btugi[k2 - 1] & d) >= d2) k2--;
			kari ^= N ^ k1 ^ k2;
		}

		kotae += (kari & 1) << i;
	}

	int d2 = 1 << 28;
	int k = N;
	int kari = N;
	rep(j, N) {
		while (k > 0 && a[0][j] + b[0][k - 1] >= d2) k--;
		kari ^= k;
	}
	kotae += (kari & 1) << 28;

	printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 3456
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int num[305][305],now[305],cnt[305];
bool in[305];

bool check(int n,int m,int mid) {
  memset(in,1,sizeof(in));
  for(int i=1;i<=n;i++) now[i]=1;
  for(;;) {
  	memset(cnt,0,sizeof(cnt));
  	for(int i=1;i<=n;i++) {
  		while (now[i]<=m&&!in[num[i][now[i]]]) now[i]++;
  		if (now[i]>m) return 0;
  		cnt[num[i][now[i]]]++;
	  }
	bool ok=1;
	for(int i=1;i<=m;i++)
	  if (cnt[i]>mid) {
	  	ok=0;
	  	in[i]=0;
	  }
	if (ok) return 1;
  }
}

int main() {
  int n,m;
  scanf("%d%d",&n,&m);
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++) scanf("%d",&num[i][j]);
  int l=1,r=n;
  while (l<r) {
  	int mid=((l+r)>>1);
  	if (check(n,m,mid)) r=mid; else l=mid+1;
  }
  printf("%d\n",l);
  return 0;
}

Measured memory_bytes: 512
// vim: foldmethod=marker
#include <iostream> // cout, endl, cin{{{
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
typedef long long ll;/*}}}*/

int main(int argc, char *argv[])
{
  ll n;
  cin >> n;
  string s, t;
  cin >> s >> t;

  for (int i = 0; i < n; ++i) {
    cout << s.at(i) << t.at(i);
  }
  cout << endl;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;    
#define int long long        
#define endl "\n"
#define deb(x) cout<<#x<<" "<<x<<endl
#define sc(ar,n) for(int pen=0;pen<n;pen++){ cin>>ar[pen];}
#define pr(ar) for(int pen=0;pen<sizeof(ar)/8;pen++){ cout<<ar[pen]<<" ";} cout<<endl;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rt return 0;
#define mod 1000000007
const int N= 1e5+ 10;
int st[N]={0};
const int INF = 1e16;
void update(int ss, int se, int i, int diff, int si)  
{  
    // Base Case: If the input index lies outside the range of  
    // this segment  
    if (i < ss || i > se)  
        return;  
  
    // If the input index is in range of this node, then update  
    // the value of the node and its children  
    st[si] = st[si] + diff;  
    if (se != ss)  
    {  
        int mid = (ss+se)/2;  
        update(ss, mid, i, diff, 2*si);  
        update(mid+1, se, i, diff, 2*si + 1);  
    }  
}  
int get_sum(int ss, int se, int qs, int qe, int si)  
{  
    // If segment of this node is a part of given range, then return  
    // the sum of the segment  
    if (qs <= ss && qe >= se)  
        return st[si];  
  
    // If segment of this node is outside the given range  
    if (se < qs || ss > qe)  
        return 0;  
  
    // If a part of this segment overlaps with the given range  
    int mid = (ss+se)/2;
    return get_sum(ss, mid, qs, qe, 2*si) +  
        get_sum(mid+1, se, qs, qe, 2*si+1);  
}
vector <int> vt[N];
int vis[N]={0};
int dp[N];
void dfs(int u){
    vis[u]=1;
    dp[u]=0;
    for(int ch:vt[u]){
        vis[ch]=1;
        if(dp[ch]==-1)
        {
            dfs(ch);
        }
        dp[u]=max(dp[u],1 + dp[ch]);
    }
}
signed main()
{
    fastio;
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        vt[x].push_back(y);
    }
    for(int i=0;i<=n;i++)
    dp[i]=-1;
    for(int i=1;i<=n;i++)
    {
        if(vis[i]!=1){
            dfs(i);
           // cout<<dp[i]<<endl;
        }
    }
    int mx=-1;
    for(int i=1;i<=n;i++)
    mx=max(mx,dp[i]);
    cout<<mx<<endl;
}

Measured memory_bytes: 9472
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
using namespace std;
ll a[100010],b[100010];
int main()
{
	int i,j,n,m,x,y,t;
	ll k;
	scanf("%d%d%d",&n,&m,&t);
	for(i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
	}
	for(i=0;i<m;i++)
	{
		scanf("%lld",&b[i]);
	}
	ll ans;
	while(t--)
	{
		scanf("%lld",&k);
		x=lower_bound(a,a+n,k)-a;
		y=lower_bound(b,b+m,k)-b;
		ans=1e16;
		if(x<n&&y<m)
		{
			ans=min(ans,max(a[x],b[y])-k);
		}
		if(x>0&&y>0)
		{
			ans=min(ans,k-min(a[x-1],b[y-1]));
		}
		if(x>0&&y<m)
		{
			ans=min(ans,b[y]-a[x-1]+min(k-a[x-1],b[y]-k));
		}
		if(y>0&&x<n)
		{
			ans=min(ans,a[x]-b[y-1]+min(k-b[y-1],a[x]-k));
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 2816
package main

import (
	"fmt"
)

func main() {
	var S string
	fmt.Scanf("%s\n", &S)
	s := []rune(S)
	if string(s[2]) == string(s[3]) && string(s[4]) == string(s[5]) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")

	}

}


Measured memory_bytes: 512
N, *A = map(int, open(0).read().split())
print(*A)

for i, a in enumerate(A):
    if i == 0:
        continue
    
    j = i-1
    while j >= 0 and A[j]>a:
        A[j], A[j+1] = a, A[j]
        j -= 1
    
    print(*A)



Measured memory_bytes: 5980
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    vector <int> dp(n);
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (i == 0)
        {
            dp[i] = 1;
        }
        else
        {
            if (a[i] != a[i - 1])
            {
                dp[i] = dp[i - 1] + 1;
            }
            else
            {
                dp[i] = max(dp[i - 1], (i == 1 ? 0 : dp[i - 2]) + 1);
            }
        }
        ans = max(ans, dp[i]);
    }
    cout << n - ans << '\n';
}


Measured memory_bytes: 892
#include <stdio.h>
int occu[200001],cnt[200001],a[200001];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int empty=n;
	for (int i=1;i<=n;++i)
	{
		scanf("%d",a+i);
		++cnt[a[i]];
		if (a[i]-cnt[a[i]]>=0)
		{
			if (!occu[a[i]-cnt[a[i]]])
				--empty;
			++occu[a[i]-cnt[a[i]]];
		}
	}
	for (int i=1;i<=m;++i)
	{
		int idx,after;
		scanf("%d%d",&idx,&after);
		int before=a[idx];
		if (before-cnt[before]>=0)
		{
			--occu[before-cnt[before]];
			if (!occu[before-cnt[before]])
				++empty;
		}
		--cnt[before];
		a[idx]=after;
		++cnt[after];
		if (after-cnt[after]>=0)
		{
			if (!occu[after-cnt[after]])
				--empty;
			++occu[after-cnt[after]];
		}
		printf("%d\n",empty);
	}
	return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
typedef pair <int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
template <typename T>
inline void read(T &x) {
	x = 0;
	T f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -1;
	for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	x *= f;
}
inline void d_read(double &x) {
	x = 0.0;
	int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -1;
	for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
	if (c == '.'){
		double num = 1.0;
		c = getchar();
		for (; isdigit(c); c = getchar()) x = x + (num /= 10) * (c ^ 48);
	}
	x *= f;
}

template <typename T>
inline void w(T x) {
	if (x > 9) w(x / 10);
	putchar(x % 10 + 48);
}
template <typename T>
inline void write(T x, char c) {
	if (x < 0){
		putchar('-');
		x = -x;
	}
	w(x);
	putchar(c);
}
char a[200005], b[200005];
int main(){
	scanf("%s", a + 1);
	scanf("%s", b + 1);
	int ans = 0;
	for (int i = 1; i <= strlen(a + 1); i ++ ) {
		if (a[i] != b[i]) ans ++;
	}
	write(ans, '\n');
	return 0;
}


Measured memory_bytes: 4152
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class Main {
	
    public static void main(String[] args) throws IOException {
    	Scanner s = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] input;
		int[] arr = new int[5];
		int ans = 0;
		for(int i = 0; i < 5; i++) {
			arr[i] = s.nextInt();
			if(arr[i] == 0) {
				ans = i + 1;
			}
		}
		out.print(ans);
		out.flush();
		out.close();
    }
}


Measured memory_bytes: 35780
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
d = []
for i in range(N):
    if T[i] == "r":
        if i < K or d[i-K] != "p":
            d.append("p")
        else:
            d.append("a")
    elif T[i] == "s":
        if i < K or d[i-K] != "r":
            d.append("r")
        else:
            d.append("a")
    else:
        if i < K or d[i-K] != "s":
            d.append("s")
        else:
            d.append("a")
ans = d.count("r") * R + d.count("s") * S + d.count("p") * P
print(ans)

Measured memory_bytes: 79236
#include <cstdio>
#include <stdlib.h>
using namespace std;
int main() {
	int N, M;
	scanf("%d %d", &N, &M);
    int sum = 0;
    for (int i=0; i < M; i++) {
        int A;
        scanf("%d", &A);
        sum += A;
    }
    int result;
    if (sum > N) {
        result = -1;
    } else {
        result = N - sum;
    }
	printf("%d\n", result);
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
char a[5]={'a','e','i','o','u'};
int main(){
    char s;
    cin>>s;
    for(int i=0;i<5;i++){
        if(s==a[i]){
            cout<<"vowel"<<endl;
            return 0;
        }
    }
    cout<<"consonant"<<endl;
    return 0;
}

Measured memory_bytes: 256
h,w = gets.chomp.split(" ").map(&:to_i)
a = h.times.map{gets.chomp.split("")}
for i in 0..h-1
  a[i].unshift("#") << "#"
end
a.unshift(Array.new(w+2,"#")) << Array.new(w+2,"#")
for i in 0..h+1
  puts a[i].join
end

Measured memory_bytes: 2300
#include<cstdio>

int main(){
    while(1){
        char str[1000];
        scanf("%s", str);
        if(str[0] == '0') break;

        int i=0, sum=0;
        while(str[i]){
            sum += str[i] - '0';
            i++;
        }

        printf("%d\n", sum);
    }

    return 0;
}


Measured memory_bytes: 2696
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <queue>
#include <vector>
using namespace std;
typedef char chr;
typedef double  dbl;
typedef long long int lld;
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
double getComb (double n, double x){
    if (x > n){
        return 0;
    }
    else{
        double r = 1.0;
        for(double i = 1.0; i<=x;i+=1){
            double a = n-i+1;
            double b = a / i;
            r*=b;
        }
        return r;
    }
}
lld gcd (lld a, lld b){
	lld max = a > b ? a : b;
	lld min = a < b ? a : b;
	lld rem;
	while (min != 0){
		rem = max % min;
		max = min;
		min = rem;
	}
	return  (max);
}
int main () {
    FastIO
    lld K, a;
    lld b, c;
    cin >> K;
    lld r, q;
    lld s = 0;
    for(a = 1; a <= K; a += 1){
    	for(b = 1; b<=K; b+=1){
    		for(c=1;c<=K;c+=1){
    			r = gcd(a , b);
    			q = gcd(r , c);
    			s+= q;
    		}
    	}
    }
    cout << s << "\n";
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>

using namespace std;

int main()
{
    char a, b, c;
    cin >> a;
    
    if(90 >= a && a >= 65)
        cout << 'A' << endl;
    else if(122 >= a && a >= 97)
        cout << 'a' << endl;

    return 0;
}

Measured memory_bytes: 3628
N = int(input())
l = list(map(int,input().split(' ')))
mid = N // 2
MAP = [0]*N
ans_l = []

for i in range(N,0,-1):
    s = N // i + 1
    t = 0
    for j in range(1,s):
        t += MAP[i*j-1]
    if t%2 != l[i-1]:
        ans_l.append(str(i))
        MAP[i-1] = 1
leng = len(ans_l)
print(leng)
print(" ".join(ans_l))

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


typedef long long ll;

using namespace std;


const ll mod=1000000000+7;





int main(){

    int N;
    cin>>N;

    int d1,d2;

int count=0;

bool flag=false;

    for(int i=0;i<N;++i){

        cin>>d1>>d2;

        if(d1==d2){
            ++count;
        }else{
            count=0;
        }

        if(count==3){

            flag=true;

        }


    }

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


   

    

}




Measured memory_bytes: 3584
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 100;

void trace(int A[], int N)
{
    cout << A[0];
    for(int i = 1; i < N; i++)
    {
        cout <<" "<< A[i];
    }
    cout << endl;
}

int main()
{
    int n, R[MAX];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> R[i];
    trace(R, n);

    int v, j;
    for(int i = 1; i < n; i++)
    {
        v = R[i];
        j = i - 1;
        while(j>=0 & R[j]>v)
        {
            R[j+1] = R[j];
            j --;
        }
        R[j+1] = v;
        trace(R, n);
    }
    return 0;
}


Measured memory_bytes: 3124
using System;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var x = int.Parse(_[0]);
            var a = int.Parse(_[1]);
            var b = int.Parse(_[2]);

            var i = Math.Abs(x - a);
            var j = Math.Abs(x - b);

            Console.WriteLine(i > j ? "B" : "A");
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

lli n, k;

int main(void){
	cin >> n >> k;
	vector<lli> h(n);
	rep(i, n) cin >> h[i];
	vector<lli> dp(n+5, 1e18);
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = 1; j <= k; j++){
			if(i+j < n) chmin(dp[i+j], dp[i]+abs(h[i+j]-h[i]));
		}
	}
	cout << dp[n-1] << endl;
	return 0;
}


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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N;
  cin >> N;
  map<string, vector<int>> S;
  map<int, int> P;
  string s;
  int p;
  REP(i, N) {
    cin >> s >> p;
    if (S.find(s) == S.end()) {
      S.insert(make_pair(s, vector<int>(1, p)));
    } else {
      S.at(s).push_back(p);
    }
    P.insert(make_pair(p, i));
  }

  for (auto it : S) {
    sort(it.second.begin(), it.second.end(), greater<int>());
    for (int const &i : it.second) {
      cout << P.at(i) + 1 << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let mut a=read::<String>().as_bytes().iter().map(|c|*c as char).collect::<Vec<char>>();
    a[3]='8';
    println!("{}",a.iter().map(|c|*c).collect::<String>());
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {
  int age,a,b;
  cin >>age;
  
  if(age==1){
    cout <<"Hello World" <<endl;
  }
  else if(age==2){
    cin >>a >>b;
    cout <<a+b <<endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 200005;
int a[MAXN],ans,dp[MAXN];
int main(){
	int n;
	while(scanf("%d",&n)==1){
	ans=0;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		dp[a[i]]=max(dp[a[i]],dp[a[i]-1]+1);
		ans=max(ans,dp[a[i]]);
	}
	printf("%d",n-ans);}
	return 0;	
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <vector>
using namespace std;

vector<string> a;
int dfs(int depth,int index,bool plus){
  int ans;
  if(plus){
    ans = 0;
    for(int i = index+1;i < a.size();i++){
      if(a[i].size() <= depth)return ans;
      else if(a[i][depth] == '.')continue;
      else if(a[i][depth] == '+')
        ans += dfs(depth+1,i,true);
      else if(a[i][depth] == '*'){
        ans += dfs(depth+1,i,false);
      }else{
          ans += a[i][depth] - '0';
      }
    }
  }else{
    ans = 1;
    for(int i = index+1;i < a.size();i++){
      if(a[i].size() <= depth)return ans;
      else if(a[i][depth] == '.')continue;
      else if(a[i][depth] == '+')
        ans *= dfs(depth+1,i,true);
      else if(a[i][depth] == '*'){
        ans *= dfs(depth+1,i,false);
      }else{
          ans *= a[i][depth] - '0';
      }
    }
  }
  return ans;
}

int main(){
  int n;
  while(cin >> n,n){
    a.resize(n);
    for(int i = 0;i<n;i++){
      cin >> a[i];
    }
    if(n == 1)cout << a[0] << endl;
    else cout << dfs(1,0,a[0][0] == '+') << endl;
    a.clear();
  }
}

Measured memory_bytes: 3152
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int vs[100000+10];

int main(void) {
  int n;
  scanf("%d", &n);
  REP(i, n) {
    scanf("%d", &vs[i]);
  }
  sort(vs, vs + n);
  int res = vs[n/2] - vs[n/2-1];
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 888
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]

for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i]>K:
        break
    while b[j]>K-a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)


Measured memory_bytes: 47692
n = gets.to_i
s = []
n.times {
  a,b = gets.split
  s << [a.chomp, b.to_i]
}
x = gets.chomp
flag = false
ans = 0
s.each {|arr|
  ans += arr[1] if flag
  flag = true if arr[0]==x
}
p ans


Measured memory_bytes: 1788
import java.util.Scanner;
public class Main {
	static int[][] gyo2=new int[100000][12];
	static int count=0;
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int M=sc.nextInt();
		long X=sc.nextLong();
		int C[]=new int[N];
		int A[][]=new int[N][M];
		for(int i=0;i<N;i++) {
			C[i]=sc.nextInt();
			for(int j=0;j<M;j++) {
				A[i][j]=sc.nextInt();
			}
		}
		int gyo[]=new int[N];
		zenbit(0,N,gyo);
		long ans=1000000000;
		boolean flag=true;
		boolean kuso=false;
		for(int i=0;i<count;i++) {
			int money=0;
			int kari[]=new int[M];
			for(int j=0;j<N;j++) {
			if(gyo2[i][j]==1) {
				for(int z=0;z<M;z++) {
				kari[z]+=A[j][z];
				}
				money+=C[j];
			}
				}
			for(int j=0;j<M;j++) {
				if(X>kari[j]) {
					flag=false;
					//System.out.println(money);
					//System.out.println(kari[j]);
				}
			}
			if(flag) {kuso=true;
			}
			if(flag&&(ans>money)) {
				ans=money;
			}
			flag=true;
		}
		if(kuso) {
			System.out.println(ans);
		}else {
			System.out.println(-1);
		}

}
	public static void zenbit(int kosu,int N,int gyo[]) {
		if(kosu<N) {
			gyo[kosu]=0;
			zenbit(kosu+1,N,gyo);
			gyo[kosu]=1;
			zenbit(kosu+1,N,gyo);
		}else {
			for(int i=0;i<N;i++) {
				gyo2[count][i]=gyo[i];
			}
			count++;
			return;
		}
	}

}


Measured memory_bytes: 44396
// https://atcoder.jp/contests/abc155/tasks/abc155_c

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N;
  cin >> N;

  map<string, ll> ct_map;

  rep(i, N) {
    string s;
    cin >> s;
    ct_map[s]++;
  }

  ll max_ct = 0;
  for (auto e : ct_map) {
    chmax(max_ct, e.se);
  }

  V<string> res(0);

  for (auto e : ct_map) {
    if (e.se == max_ct) res.emplace_back(e.fi);
  }

  sort(all(res));

  for (auto s : res) {
    cout << s << endl;
  }
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 25584
#include <bits/stdc++.h>
using namespace std;
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}
const int maxn = 3e5 + 50;

int n , m , dis[maxn] , q , v[maxn] , d[maxn] , c[maxn] , col[maxn][11];
vector < int > Edge[maxn];
queue < pair < int , int > > que;

void Solve( int x , int mxd , int target ){
	if( col[x][mxd] )
		return ;
	que.push( make_pair( x , mxd ) );
	col[x][mxd] = target;
	while( !que.empty() ){
		pair < int , int > st = que.front() ; que.pop();
		int z = st.first , y = st.second;
		if( y == 0 )
			continue;
		for(auto v : Edge[z])
			if( !col[v][y - 1] ){
				col[v][y - 1] = target;
				que.push( make_pair( v , y - 1 ) );
			}
	}
}

int main( int argc , char * argv[] ){
	memset( dis , 0x3f , sizeof( dis ) );
	n = read() , m = read();
	for(int i = 1 ; i <= m ; ++ i){
		int u = read() , v = read();
		Edge[u].emplace_back( v );
		Edge[v].emplace_back( u );
	}
	q = read();
	for(int i = 1 ; i <= q ; ++ i) v[i] = read() , d[i] = read() , c[i] = read();
	for(int i = q ; i >= 1 ; -- i)
		Solve( v[i] , d[i] , i );
	for(int i = 1 ; i <= n ; ++ i){
		int mx = 0;
		for(int j = 0 ; j <= 10 ; ++ j)
			mx = max( mx , col[i][j] );
		printf( "%d\n" , c[mx] );
	}
	return 0;
}

Measured memory_bytes: 23080
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        dd: [(usize, usize); n],
    }

    let mut count = 0;

    for (d1, d2) in dd {
        if d1 == d2 {
            count += 1;
            if count == 3 {
                println!("Yes");
                return;
            }
        } else {
            count = 0;
        }
    }

    println!("No");
}


Measured memory_bytes: 2160
#pragma GCC optimize("Ofast",3,"inline")
#include <bits/stdc++.h>
using namespace std;
int a[50],b[50],c[50],n;
long long ans;
int main(){
	ios_base::sync_with_stdio(false);
	cin>>n;
	a[0]=-1;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)cin>>b[i];
	for(int i=1;i<n;i++)cin>>c[i];
	for(int i=1;i<=n;i++){
		ans+=b[a[i]];
//		cout<<ans<<'\n';
		if(a[i]==a[i-1]+1)ans+=c[a[i-1]];
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<ll,ll>
#define poly vector<ll>
#define mem(a) memset((a),0,sizeof(a))
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x.size()))
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=100005;
ll q[N],a[N],m,v,p;
int n;
bool check(int x){
	int qq=0;
	if(v>=p){
		For(i,p,n)if(i!=x){
			q[++qq]=a[x]+m-a[i];
		}
		int vv=v-(p-1); ll sum=0;
		For(i,1,qq){
			if(q[i]<0)return 0;
			sum+=q[i];
			if(sum<(ll)(vv-(qq-i))*m)return 0;
		}
		return 1;
	}else{
		return a[x]+m>=a[p];
	}
}
int main(){
	#ifdef Brollan
		freopen("1.in","r",stdin);
	#endif
	cin>>n>>m>>v>>p; v--;
	For(i,1,n)a[i]=read();
	sort(a+1,a+n+1);
	reverse(a+1,a+n+1);
	int l=p,r=n;
	while(l<r){
		int mid=(l+r)>>1; mid++;
		if(check(mid))l=mid; else r=mid-1;
	}
	cout<<l<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
uint64_t combi(uint64_t n, uint64_t x) {
	uint64_t res = 1;
	if (x == 0) {
		return res;
	}
	for (uint64_t d = 1; d <= x; d++) {
		res *= n--;
		res /= d;
	}
	return res;
}

int main() {
	uint64_t n, p;
	cin >> n >> p;
	vector<uint64_t>a(2, 0);
	for (int i = 0; i < n; i++) {
		uint64_t x = 0;
		cin >> x;
		if (x % 2 == 0)a.at(0)++;
		else a.at(1)++;
	}
	//0がzero個,1がone個あり、その中から個数は自由に選んで、%2=pにする
	//p=1の場合、(oneC1+oneC3+oneC5+...)*(zeroC0+zeroC1+zeroC2+...zeroCzero)
	//p=0の場合、(oneC0+oneC2+oneC4+...)*(zeroC0+zeroC1+zeroC2+...zeroCzero)
	uint64_t ans = 0;
	for (int i = p; i <= n; i = i + 2)ans += combi(a.at(1), i);
	uint64_t zeroans = 0;
	for (int i = 0; i <= a.at(0); i++) {
		zeroans += combi(a.at(0), i);
	}
	ans *= zeroans;
	cout << ans << endl;
}


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

int main(){
    int n,k;
    cin >> n >> k;
    vector<pll> xy(n);
    rep(i,n) cin >> xy[i].first >> xy[i].second;
    sort(xy.begin(),xy.end());
    ll ans = INF;
    bool update = false;
    for(int i=0;i<=n-k;i++){
        for(int j=i+k-1;j<n;j++){
            ll dx = xy[j].first - xy[i].first;
            vector<ll> y(j-i+1);
            for(int idx=i;idx<=j;idx++){
                y[idx-i] = xy[idx].second;
            }
            sort(y.begin(),y.end());
            int p = j-i+1;
            for(int idx=0;idx<=p-k;idx++){
                ll mn = y[idx];
                ll mx = y[idx+k-1];
                if(!update){
                    ans = (mx-mn)*dx;
                    update = true;
                }
                ans = min(ans,(mx-mn)*dx);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <climits>
#include <math.h>
 
using namespace std;
typedef unsigned long ul;

int main() {
	long n,m,d;
	cin>>n>>m>>d;
	double k = (double)(m - 1) / n / n;
	double r = n * k;
	if(d != 0) r += (n - d - d) * k;
	printf("%.10f\n", r);
	//cout<<r<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
using namespace std;
typedef long long ll;

int main() {
    int a; cin >> a;
    string s; cin >> s;
    if (a >= 3200) cout << s << endl;
    else cout << "red" << endl;
}


Measured memory_bytes: 256
N=int(input())
S=input()
Z=[]
count=len(S)

for i in range(count):
    tmp=ord(S[i])
    if tmp+N>90:
        tmp=tmp+N-26
    else:
        tmp+=N
    Z.append(chr(tmp))


L=[str(a) for a in Z]
L="".join(L)
print(L)


Measured memory_bytes: 3188
#include <iostream> 
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <cctype>
#include <climits>

using namespace std;

using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;

using ll = long long int;

#define mp(a,b) make_pair(a,b)

const int MOD = 1000 * 1000 * 1000 + 7;

bool res() {
	string s1, s2;
	cin >> s1 >> s2;
	if (!cin) return false;
	int a, b;
	cin >> a >> b;
	string s;
	cin >> s;
	if (s == s1) cout << a - 1 << ' ' << b << '\n';
	else cout << a << ' ' << b - 1 << '\n';
	

	return true;
}

int main() {
	while (res()) {}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
     int n,s,Min=999999;
    scanf("%d",&n);
    for(int i=1;i<=(n+1)/2;i++)
    {
        s=0;
        int t1=n-i,t2=i;
        while(t2)
        {
            s+=t2%10;
            t2/=10;
        }
        while(t1)
        {
            s+=t1%10;
            t1/=10;
        }
        if(s<Min)
            Min=s;
            //printf("%d %d\n",i,s);
    }
    printf("%d\n",Min);
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

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

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define pb push_back

const int inf = 999999999;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

ll dp[51][51][2501];

int main(){
	int n, a; cin >> n >> a;
	int x[n];
	Rep(i, n){
		cin >> x[i];
	}
	dp[0][0][0] = 1;
	Rep(i, n){
		Rep(j, n){
			Rep(k, 2501){
				if(k >= x[i]){
					dp[i+1][j+1][k] = dp[i][j+1][k] + dp[i][j][k-x[i]];
				}else{
					dp[i+1][j][k] = dp[i][j][k];
				}
			}
		}
	}
	ll ans = 0;
	For(i, 1, n+1){
		ans += dp[n][i][i*a];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 50048
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const long long mod=1000000000+7;
vector <int> g[100001];
long long f[100001][2];
int dd[100001],d2[100001][2];
int n;
long long qhd(int u,int tt){
    dd[u]=1;
    long long sum=1;
    if (d2[u][tt]==0){
        for (auto i=g[u].begin();i!=g[u].end();++i){
            sum=1;
            if (dd[*i]==0){
                sum=qhd(*i,0);
                if (tt==0) sum+=qhd(*i,1);
            }
            f[u][tt]=f[u][tt]*sum;
            f[u][tt]=f[u][tt]%mod;
        }
        d2[u][tt]=1;
    }
    dd[u]=0;
    return f[u][tt];
}
int main()
{
    cin>>n;
    int u,v;
    for (int i=0;i<n-1;++i){
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    for (int i=1;i<=n;++i) {
        f[i][0]=1;
        f[i][1]=1;
    }
    cout<<(qhd(1,0)+qhd(1,1))%mod;
}


Measured memory_bytes: 15360
#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>
#include <sstream>
using namespace std;

int n;

int main(void){
	scanf("%d",&n);
	stringstream ss;
	int a=n,b=n;
	while(1){
		if(a>=0){
			ss << a;
			string l=ss.str();
			string r=ss.str();
			ss.str("");
			reverse(r.begin(),r.end());
			if(l==r){
				printf("%d\n",a);
				return 0;
			}
		}
		a--;

		ss << b;
		string l=ss.str();
		string r=ss.str();
		ss.str("");
		reverse(r.begin(),r.end());
		if(l==r){
			printf("%d\n",b);
			return 0;
		}
		b++;
	}
	return 0;
}

Measured memory_bytes: 1264
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#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 FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define LL long long
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
  int N,D,X,A;
  cin>>N>>D>>X;
  FOR(i,0,N){
    cin>>A;
    int now=1;
    while(now<=D){
      X++;
      now+=A;
    }
  }
  cout<<X<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll ans1 = a * c;
  ll ans2 = a * d;
  ll ans3 = b * c;
  ll ans4 = b * d;
  cout << max(max(ans1, ans2), max(ans3, ans4)) << endl;
}

Measured memory_bytes: 3684
#include "bits/stdc++.h"
#define MAXN 200009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
char s[MAXN];
int F[MAXN];
map<ll,int>pm;
ll par[MAXN];
void upd(int x){
	for(;x<MAXN;x+=x&(-x))
		F[x]++;
}
int tap(int x){
	int res=0;
	for(;x;x-=x&(-x))
		res+=F[x];
	return res;	
}
int main(){
	//~ #ifndef ONLINE_JUDGE
    //~ freopen("file.in", "r", stdin);
	//~ #endif	
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		par[i]=par[i-1]+(x-k);
		pm[par[i]]=1;
	}int c=0;pm[0]=1;
	tr(it,pm)
		it->ss=++c;
	for(int i=0;i<=n;i++)
		par[i]=pm[par[i]];
	upd(par[0]);ll ans=0;
	for(int i=1;i<=n;i++){
		ans+=tap(par[i]);
		upd(par[i]);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 15104
N = gets.chomp.to_i
input = Array.new(N) { gets.chomp.split(' ') }
new_input = input.map do |item|
  if item[1] == 'JPY'
    item[0].to_f
  else
    item[0].to_f * 380000.0
  end
end
p new_input.inject(:+)


Measured memory_bytes: 1788
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int k = scanner.nextInt();
			scanner.nextLine();
			char[] s = scanner.nextLine().toCharArray();
			List<Result> list = new ArrayList<>();
			int max = 0;
			boolean isOne;
			if (s[0] == '0') {
				list.add(new Result(k, 0, 0));
				isOne = true;
			} else {
				isOne = false;
			}
			for (int i = 0; i < s.length; i++) {
				if (isOne && ('0' == s[i])) {
					for (int j = 0; j < list.size(); j++) {
						Result result = list.get(j);
						if (result.k > 0) {
							result.k--;
						} else {
							result.count = i - result.start;
							if (result.count > max) {
								max = result.count;
							}
							list.remove(j);
							j--;
						}
					}
					isOne = false;
				} else if (!isOne && ('1' == s[i])) {
					if (i < n - max) {
						list.add(new Result(k, i, 0));
					}
					isOne = true;
				}
				if (!list.isEmpty() && list.get(0).start > n - max) {
					break;
				}
			}
			if (!list.isEmpty()) {
				Result result = list.get(0);
				result.count = n - result.start;
				if (result.count > max) {
					max = result.count;
				}
			}
			System.out.println(max);
		}
	}

	private static class Result {
		int k;
		int start;
		int count;

		Result(int k, int start, int count) {
			super();
			this.k = k;
			this.start = start;
			this.count = count;
		}

		@Override
		public String toString() {
			return "k=" + k + ",start=" + start + ",count=" + count;
		}
	}
}


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

using ll=long long; 

void solve(){
	int a,b;
	cin>>a>>b;
	int l10=1;
	while(l10<=b){
		l10*=10;
	}
	a=a*l10+b;
	for(int i=1; i*i<=a; i++){
		if(i*i==a){
			cout<<"Yes"<<endl;
			return;
		}
	}
	cout<<"No"<<endl;
}

signed main(){
	//while(1)
	solve();
}


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

const int M = 1000005;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> cnt(M);
  for (int x : a) {
    if (cnt[x] != 0) {
      cnt[x] = 2;
      continue;
    }
    for (int i = x; i < M; i += x) cnt[i]++;
  }
  int ans = 0;
  for (int x : a) {
    if (cnt[x] == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7956
#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()
{
  ll n;
  cin >> n;
  
  ll a[n];
  rep(i,n) cin >> a[i];
  
  int ans = 0;
  while(1){
    rep(i,n){
      if(a[i] % 2 == 0){
        a[i] /= 2;
      }else{
        cout << ans << endl;
        return 0;
      }
    }
    ans++;
  }
}

Measured memory_bytes: 3572
program main
  implicit none
  integer(8) :: n, a,b
  integer(8) :: a_1, b_1
  integer(8) :: i, tot
  integer(8) :: mbase
  mbase = 10**9+7
  read(*,*) n, a, b
  tot =  mpow( int(2,8), n, mbase ) -1 ! total -1
  write(*,'(i0)') modulo (tot - nCr(n,a) - nCr(n,b),mbase)
  stop
contains
  integer(8) function mpow(a,n,mbase )
    ! a**n mod mbase
    integer(8) :: a
    integer(8) ::  n, mbase
    integer(8) :: ntmp, atmp
    mpow = 1
    atmp = a
    ntmp = n
    do while(ntmp > 0)
       !if ( mod(ntmp,2) == 0   ) mpow = modulo( mpow * atmp,mbase)
       if ( iand(ntmp,1) >0 ) mpow = modulo( mpow * atmp,mbase)
       atmp = modulo( atmp * atmp, mbase )
       ntmp = ishft(ntmp,-1)
    end do
  end function mpow

  
  integer function nCr(n,r )
    integer(8) :: n, r
    integer(8) :: n_r
    integer(8) :: i
    integer(8) :: n1, n2
    integer(8) :: inv, inv2
    n_r = n-r
    n1 = 1
    do i = n,n_r+1,-1
       n1 =  mod(n1*i,mbase)
    end do
    n2 = 1
    do i = 1,r
       n2 = mod(n2*i,mbase)
    end do
    n2 = mpow(n2,mbase-2,mbase)
    nCr =  mod( n1*n2,mbase)
  end function nCr
  
end program main

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

int main()
{
    long double a,b,h,m,t;
    cin>>a>>b>>h>>m;
    m=m*6;
    h=(h*30)+(m/12);
    t=abs(h-m);
    long double deg;
    deg=(t*pi)/180;
    long double c=(a*a)+(b*b)-((2*a*b)*cos(deg));
    long double C=sqrt(c);
    cout<<fixed<<showpoint;
    cout<<setprecision(20);
    cout<<C<<endl;
    return 0;
}

Measured memory_bytes: 4100
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

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

int main(void) {
    int n; cin >> n;
    vector<int> a(n);

    rep(i, n) {
        cin >> a[i];
    }

int ans = 0;
    for(int i = 0;i < n; i++) {
        for(int j = i+1; j < n; j++) {
            for(int k = j+1; k < n; k++) {
                if(a[i] != a[j] && a[j] != a[k] && a[k] != a[i]) {
                    vector<int> b(3);
                    b[0] = a[i];
                    b[1] = a[j];
                    b[2] = a[k];

                    sort(all(b));
                    if(b[2] < b[0] + b[1]) {
                        ans ++;
                    }
                }
            }
        }

    
    }

    cout << ans << endl;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; i++){
        cin >> H.at(i);
    } 
    int max_H;
    max_H = H.at(0);
    int count = 1;
    for (int i = 1; i < N; i++){
        if (H.at(i) >= max_H){
            count++;
            max_H = H.at(i);
        }
    }
    cout << count << endl;
}

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

int main(){
  int K, A, B;
  cin >> K >> A >> B;
  bool state = false;
  for(int i=A;i<=B;i++){
    if(i%K == 0) state = true;
  }
  if(state){
    cout << "OK" << endl;
  }else{
    cout << "NG" << endl;
  }
  return 0;
}

Measured memory_bytes: 3636
from itertools import permutations as P

N = int(input())
V = [tuple(map(int, input().split())) for _ in range(N)]

dp = [[0]*3 for _ in range(N+1)]

l = tuple(P(range(3), 2))

for i in range(N):
	for j in range(6):
		a, b = l[j]

		dp[i+1][b] = max(dp[i+1][b], dp[i][a] + V[i][b])

#print(dp)
print(max(dp[-1]))

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

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

    int count=0;
    int max=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='A' ||s[i]=='C' ||s[i]=='G' ||s[i]=='T')count++;
        else{
            if(count>max)max=count;
            count=0;
        }
    }

    if(count>max)max=count;

    cout<<max<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
const ll INF = 999999999999999;
const ll MOD = 1000000007 /*988244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, m, n, t, r, k, w, l, ans, i, j;
string S, T;
vl A, B;
vl g[MAX_N];
vl visited(MAX_N, 0);
void solve() {
    i = 0;
    queue<ll> q;
    q.push(i);
    vl d(n, -1);
    d[i] = 0;
    while(!q.empty()) {
        int v = q.front();
        q.pop();
        for(ll x : g[v]) {
            if(d[x] == -1) {
                d[x] = v;
                q.push(x);
            }
        }
    }

    rep(i, n) {
        if(d[i] == -1)
            ans = -1;
    }

    if(ans == -1) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
        rep(i, n - 1) { cout << d[i + 1] + 1 << endl; }
    }
}
int main() {
    // cout<<fixed<<setprecision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    rep(i, m) {
        cin >> x >> y;
        x--;
        y--;
        g[x].pb(y);
        g[y].pb(x);
    }
    solve();
}

Measured memory_bytes: 26152
#include <iostream>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b||b==c||c==a){
    if(a==b&&b==c&&c==a){
      cout<<"No"<<endl;
    }
    else{
      cout<<"Yes"<<endl;
    }
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}


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

int H, W;
char s[50][50];

bool check(int i, int j)
{
    if (i >= 0 && s[i-1][j] == '#') {
        return true;
    }
    if (i < 50 && s[i+1][j] == '#') {
        return true;
    }
    if (j >= 0 && s[i][j-1] == '#') {
        return true;
    }
    if (j < 50 && s[i][j+1] == '#') {
        return true;
    }
    return false;
}

main()
{
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> s[i][j];
        }
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (s[i][j] == '.') {
                continue;
            }
            if (!(s[i][j] == '#' && check(i, j))) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		Console.WriteLine(S.Zip(T, (c, d) => c == d ? 1 : 0).Sum());
	}
	char[] S,T;
	public Sol(){
		S = rs().ToCharArray();
		T = rs().ToCharArray();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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


#define DIGIT (80)

int main()
{
	int i, j, n, temp, overFlow = 0;
	char num[2][DIGIT + 1];
	char ans[DIGIT + 2];
	char fmt[8];
	int len[2], index;
	
	// scanf format
	sprintf(fmt, "%%%ds", DIGIT);
	
	scanf("%d", &n);
	
	for (i = 0; i < n; ++i) {
		overFlow = 0;
		for (j = 0; j < 2; ++j) {
			scanf(fmt, num[j]);
			while (getchar() != '\n') overFlow = 1;
			
			len[j] = strlen(num[j]);
			//printf("num : %s\nlen : %d\n", num[j], len[j]);
		}
		if (overFlow) {
			puts("overflow");
			continue;
		}
		
		// bigger one
		index = (len[0] < len[1]) ? 1 : 0;
		
		ans[0] = ans[len[index] + 1] = '\0';
		
		temp = 0;
		for (j = 1; j <= len[index ^ 1]; ++j) {
			temp += (num[0][len[0] - j] - '0') + (num[1][len[1] - j] - '0');
			ans[len[index] - j + 1] = temp % 10 + '0';
			temp /= 10;
		}
		for (; j <= len[index]; ++j) {
			temp += (num[index][len[index] - j] - '0');
			ans[len[index] - j + 1] = temp % 10 + '0';
			temp /= 10;
		}
		
		if (temp) {
			if (len[index] == DIGIT) {
				puts("overflow");
			} else {
				ans[0] = '1';
				puts(ans);
			}
		} else {
			puts(ans + 1);
		}
	}
	
	return 0;
}

Measured memory_bytes: 624