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

#define mod 1000000007
/*ll ebob(ll a, ll b){
	if(a == 0) return b;
	return ebob(b%a, a);
}
ll ekok(ll a, ll b){
	return (a*b)/ebob(a,b);
}*/
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	if(n%2){
		cout<<"No";
	}else{
		string s; cin>>s;
		for(int i = 0; i < n/2; i++){
			if(s[i] != s[i + n/2]){
				cout<<"No"; return 0;
			}
		}
		cout<<"Yes";
	}
	return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K;
    cin >> N >> K;
    vec<ll> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    sort(A.begin(),A.end(),greater<ll>());
    ll ans = 0;
    for(int i=K;i<N;i++) ans += A[i];
    cout << ans << endl;
}

Measured memory_bytes: 1792
# -*- coding:utf-8 -*-

def solve():
    N, A, B = list(map(int, input().split()))
    ans = (N//(A+B))*A
    N -= (N//(A+B))*(A+B)

    if A >= N:
        ans += N
    else:
        ans += A
    print(ans)



if __name__ == "__main__":
    solve()


Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

int main()
{
	int i, j, n, m, box[1000]={0};

	while(1){
		scanf("%d%d", &n, &m);
		if(n==0 && m==0)
			break;

		for(i=0; i<1000; i++)
			box[i] = 0;

		for(i=1; i<=n; i++)
			box[i] = 1;

		j=1;
		for(i=1; i<=m*(n-1); i++){

			while(box[j] == 0){
				if(j < n)
					j++;
				else if(j == n)
					j = 1;
			}
			if(i % m == 0)
				box[j] = 0;
			if(j < n)
				j++;
			else if(j == n)
				j = 1;

		}

		for(i=1; i<=n; i++)
			if(box[i] == 1)
				printf("%d\n", i);

	}
	return 0;
}

Measured memory_bytes: 604
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define LL long long
#define MOD 100000
#define inf 1999999999


int main() {
	LL a[10];
	char s;
	cin >> a[0] >> s >> a[1];
	if (s == '+')cout << a[0] + a[1] << endl;
	else cout << a[0] - a[1] << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))
x.sort()

l = x[0]
r = x[-1]
S = 10 ** 9

for i in range(l, r+1):
    s = sum([(p-i)**2 for p in x])
    S = min(s, S)
print(S)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
    cin >> d[i];
  }
  sort(d.begin(), d.end());

  int ans = d[d.size()/2] - d[d.size()/2 - 1];
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std ;
const int N = 200 ;
int dp_less[N][5] ;
int dp_eq[N][5] ;
int a[N] ;
int main()
{
  string s ;
  int k , n ;
  cin >> s >> k ;
  n = s.size() ;
  for(int i = 0 ;i < n ;i ++)
   a[i + 1] = s[i] - '0' ;
  dp_eq[0][0] = 1;
  for(int i = 1; i <= n ;i ++)
   {
     dp_less[i][0] = 1 ;
     dp_eq[i][0] = 0 ;
     for(int j = 1 ;j <= k ;j ++)
      {
        dp_less[i][j] = dp_less[i - 1][j] + 9 * dp_less[i - 1][j - 1] ;
        if(a[i] > 0) dp_less[i][j] += dp_eq[i - 1][j] + (a[i] - 1) * dp_eq[i - 1][j - 1] ;
        if(a[i] != 0)
           dp_eq[i][j] = dp_eq[i - 1][j - 1] ;
        else dp_eq[i][j] = dp_eq[i - 1][j] ;
      }
   }
   cout << dp_less[n][k] + dp_eq[n][k] << endl ;
  return 0 ;
}


Measured memory_bytes: 256
#include<stdio.h>
int A[20], n;
int solve(int i,int m)
{
  int res;
  if(m == 0)
    {
      return 1;
    }
  if(i >= n)
    {
      return 0;
    }
  res = solve(i + 1, m) || solve(i + 1, m - A[i]);
  return res;
}
int main()
{
  int q, mj[200], i;
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    {
      scanf("%d", &A[i]);
    }
  scanf("%d", &q);
  for(i = 0; i < q; i++)
    {
      scanf("%d", &mj[i]);
    }
  
  for(i = 0; i < q; i++)
    {
      if(solve(0, mj[i]) == 1)
	{
	  printf("yes\n");
	}
      else
	{
	  printf("no\n");
	}
    }

  return 0;
}




Measured memory_bytes: 2108
#include<stdio.h>
int main()
{
	double a,b;
	while(scanf("%lf%lf",&a,&b)!=EOF){
		if(a<35.5&&b<71.0){
			printf("AAA\n");
		}else if(a<37.5&&b<77.0){
			printf("AA\n");
		}else if(a<40.0&&b<83.0){
			printf("A\n");
		}else if(a<43.0&&b<89.0){
			printf("B\n");
		}else if(a<50.0&&b<105.0){
			printf("C\n");
		}else if(a<55.0&&b<116.0){
			printf("D\n");
		}else if(a<70.0&&b<148.0){
			printf("E\n");
		}else{
			printf("NA\n");
		}
	}
	return 0;
}

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

int n;
int p;
bool is_composite[11451419];
vector<int> primes;

int main() {
  is_composite[1] = true;
  for (int i=2; i<=11451418; i++) {
    if (!is_composite[i]) {
      primes.push_back(i);
      for (int j=i+i; j<=11451418; j+=i) {
        is_composite[j] = true;
      }
    }
  }

  while (1) {
    scanf("%d%d", &n, &p);
    if (n == -1 && p == -1) return 0;

    auto itr = upper_bound(primes.begin(), primes.end(), n);
    vector<int> nums;
    for (auto i=itr; i<=itr+p; i++) {
      for (auto j=i; j<=itr+p; j++) {
        nums.push_back(*i+*j);
      }
    }
    sort(nums.begin(), nums.end());
    printf("%d\n", nums[p-1]);
  }
}

Measured memory_bytes: 17968
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  int x;
  cin >> x;
  if (x == 7 || x == 5 || x == 3) {
    cout << "YES" << "\n";
  } else {
    cout << "NO" << "\n";
  }
}


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

#define STR 100

int partition(int *A,char **B,int p,int r){	
	int x=A[r];
	int i=(p-1);
	int tmp;
	char *t=(char*)malloc(sizeof(char)*100);

	for(int j=p;j<r;j++){
		if(A[j]<=x){
			i++;
			tmp=A[i];
			A[i]=A[j];
			A[j]=tmp;
			strcpy(t,B[i]);
			strcpy(B[i],B[j]);
			strcpy(B[j],t);
		}
	}

	tmp=A[i+1];
	A[i+1]=A[r];
	A[r]=tmp;
	strcpy(t,B[i+1]);
	strcpy(B[i+1],B[r]);
	strcpy(B[r],t);
	return i+1;
}

void quickSort(int *A,char **B,int p,int r){
	int q;
	if(p<r){
		q=partition(A,B,p,r);
		quickSort(A,B,p,q-1);
		quickSort(A,B,q+1,r);
	}
}

int check_stable(int N,int *A,char **As,int *B,char **Bs){
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if(A[i]==B[j]){
				if(strcmp(As[i],Bs[j])!=0){
					return -1;
				}
				B[j]=0;
				break;
			}
		}
	}

	return 1;
}

int main(){
	int N;
	char **B,**B2;
	int *A,*A2;

	scanf("%d",&N);
	B=(char**)malloc(sizeof(char*)*N);
	A=(int*)malloc(sizeof(int)*N);
	B2=(char**)malloc(sizeof(char*)*N);
	A2=(int*)malloc(sizeof(int)*N);
	for(int i=0;i<N;i++){
		B[i]=(char*)malloc(sizeof(char)*STR);
		B2[i]=(char*)malloc(sizeof(char)*STR);
		scanf("%s %d",B[i],&A[i]);
		A2[i]=A[i];
		strcpy(B2[i],B[i]);
	}
	
	quickSort(A,B,0,N-1);

	if(check_stable(N,A,B,A2,B2)==1){
		printf("Stable\n");
	}else{
		printf("Not stable\n");
	}
		
	for(int i=0;i<N;i++){
		printf("%s %d\n",B[i],A[i]);
	}
	
	return 0;
}


Measured memory_bytes: 34220
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
int main()
{
    int n, t, a;
    cin >> n >> t >> a;
    int h[1000];
    rep(i, n){
        cin >> h[i];
    }
    
    float tmp, dif = FLT_MAX;
    int ans;
    rep(i, n){
        tmp = t - h[i]*0.006;
        if(dif > abs(tmp-a)){
            ans = i + 1;
            dif = abs(tmp-a);
        }
    }
    cout << ans;

    return 0;
}

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

/*============================ DEBUGGING =============================*/

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

/*============================= DEFINES ==============================*/

#define eps 1e-9
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x)
#define fib(n) ceil(pow((1+sqrt(5),n)-pow((1-sqrt(5),n)/(float)(pow(2,n)*sqrt(5)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define dig(n) (int)(log10(n)+1)
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define set(x,k) memset(x,k,sizeof x)

/*============================== TYPEDEFS ============================*/

typedef long long ll;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<bool> vb;
typedef queue<int> qi;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
/*============================ START FROM HERE =======================*/

int main(){
	FIO
	
	int n;cin>>n;
	int a[n];rep(i,0,n)cin>>a[i];
	sort(a,a+n);
	int ans=0;
	per(i,n-1,-1){
		int l=0,r=i-1;
		while(l<r){
			if(a[l]+a[r]>a[i]){
				ans+=(r-l);
				r--;
			}
			else l++;
		}
	}
	cout<<ans;
			
	
	return 0;
}


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

int main() {
    int A, B;
    cin >> A >> B;
    bool flag = false;
    for (int i = 1; i <= 3; ++i) {
        if ((A * B * i) % 2 == 1) flag = true;
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int N,a[300000],d=0;

#define gc() getchar()
int scan(int * N)
{
	int c,n=0;
	for(c=gc();'0'<=c&&c<='9';c=gc()){
		n=(n*10)+(c&0xf);
	}
	if(N!=NULL) *N=n;
	return n;
}

int check(int i)
{
    int r=0;
    if(0<i) r+=a[i-1]>a[i];
    if(i<N-1) r+=a[i]>a[i+1];
    return r;
}

void update(int x, int y)
{
    int tmp=a[x];
    d-=check(x);
    a[x]=a[y];
    d+=check(x);
    d-=check(y);
    a[y]=tmp;
    d+=check(y);
}

int main()
{
  int i,Q;
  scan(&N);
  scan(&a[0]);
  for(i=1;i<N;i++) d+=a[i-1]>scan(&a[i]);
  scan(&Q);
  for(i=0;i<Q;i++){
      if(d==0)break;
      update(scan(NULL)-1,scan(NULL)-1);
  }
  printf("%d\n",d?-1:i);
}



Measured memory_bytes: 3028
// abc154_a
#include <iostream>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>

#define US unsigned short
#define UI unsigned int
#define UC unsigned char
#define UL unsigned long
#define ULL unsigned long long
using namespace std;

int main(int argc, char const *argv[])
{
    string s, t, u;
    US a, b;
    cin >> s >> t >> a >> b >> u;
    if (s == u)
        cout << a - 1 << " " << b;
    else
        cout << a << " " << b - 1;
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

// gcd: 最大公約数, lcm: 最小公倍数
template<typename T>
T euclidean(T a, T b){
    if(a < b) swap(a, b);
    T r = a % b;
    while(r != 0){
        a = b; b = r; r = a % b;
    }
    return b;
}
template<typename T>
T gcd(T a, T b){
    return euclidean(a, b);
}
template<typename T>
T lcm(T a, T b){
    T g = gcd(a, b);
    return a / g * b;
}

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

    int n;
    cin >> n;
    vector<LL> t(n), a(n);
    REP(i, n) cin >> t[i] >> a[i];

    LL tnum = t[0], anum = a[0];

    REP(i, n-1){
        LL max_num = max(ceil((long double)tnum / t[i+1]), ceil((long double)anum / a[i+1]));
        tnum = t[i+1] * max_num, anum = a[i+1] * max_num;
    }
    cout << tnum + anum << endl;
}


Measured memory_bytes: 256
N,M=gets.split.map(&:to_i)
ABS=N.times.map { gets.split.map(&:to_i) }
ABS = ABS.sort {|a,b| a[0] <=> b[0]}

cnt=0
sum=0
N.times do |i|
  ABS[i][1].times do
    sum+=ABS[i][0]
    cnt+=1
    break if cnt==M
  end
  break if cnt==M
end

p sum


Measured memory_bytes: 11128
N, Y = map(int, input().split())

flg = True
for x in range(N+1):
  for y in range(N+1-x):
    _ = 10000*x + 5000*y
    if Y - _ == (N-x-y)*1000:
      ans = [x,y,N-x-y]
      flg = False
      
if flg:
  ans = [-1, -1, -1]

print(*ans)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	int a,b,c,d,e=0,f,g,h,i,j,k;
	for(d=1;d<=100;d++)
	{
	
	scanf("%d %d %d",&a,&b,&c);
	
	if(a==-1&&b==-1&&c==-1)
	{
		break;
	}
	if(a==-1||b==-1)
	{
		printf("F\n");
		continue;
	}
	
	e=a+b;
	if(e>=80)
	{
		printf("A\n");
		continue;
	}
	else if(e>=65)
	{
		printf("B\n");
		continue;
	}
	else if(e>=50||c>=50)
	{
		printf("C\n");
		continue;
	}
	else if(e>=30)
	{
		printf("D\n");
		continue;
	}
	else if(e<30)
	{
		printf("F\n");
		continue;
	}	
	}
}



Measured memory_bytes: 2064
#include<stdio.h>
 
#define H 500001
 
 
int A[H];
int n;
 
main(){
  
  int i;
 
  scanf("%d",&n);
  for(i = 1;i <= n;i++){
    scanf("%d",&A[i]);
  }
 
  buildMaxHeap();
 
  for(i = 1;i <= n;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
 
  return 0;
}

void maxHeapify(int i){
  int left = 2*i;
  int right = 2*i+1;
  int largest;
  int temp;
 
  if(left <= n && A[left] > A[i]){
    largest = left;
  }
  else{
    largest = i;
  }
  if(right <= n && A[right] > A[largest]){
    largest = right;
  }
  if(largest != i){
    temp = A[i];
    A[i] = A[largest];
    A[largest] = temp;
    maxHeapify(largest);
  }
}
 
void buildMaxHeap(void){
  int i;
  for(i = (n/2);i >=1;i--){
    maxHeapify(i);
  }
}

Measured memory_bytes: 2548
N,M=map(int,input().split())
List=[[int(i) for i in input().split()] for i in range(M)]
S=0
for i in range(M):
  new_List=list(List)
  del new_List[i]
  islands=[1]
  for i in islands:
    for j in new_List:
      if i in j:
        j=[item for item in j if item not in islands]
        islands.extend(j)
  if len(islands)<N:
    S+=1
print(S)  
  

Measured memory_bytes: 3060
# 2019/09/18

import sys
input=sys.stdin.readline

n=int(input())
cnt=0
pre=0
for i in range(n):
    a=int(input())
    if a==0:
        pre=0
        continue
    if pre:
        cnt+=1            
        a-=1
    buf=a//2
    a-=buf*2
    cnt+=buf
    pre=a

print(cnt)


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

int main(){
    int n;
    cin >> n;
    vector<int> A(n + 1);
    copy_n(istream_iterator<int>(cin), n, A.begin() + 1);

    vector<int> B(n + 1);
    vector<int> ans;
    for (int i = n; i > 0; i--){
        int b = 0;
        for (int j = i + i; j <= n; j += i){
            b ^= B[j];
        }
        B[i] = A[i] ^ b;
        if (B[i])
            ans.push_back(i);
    }

    cout << ans.size() << endl;
    copy(ans.begin(), ans.end(), ostream_iterator<int>(cout, " "));
    cout << endl;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define For(i,n) for(int i=0;i<n;i++)
#define Fre(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%d", &n)
#define sff(a,b) scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pfn(n) printf("%d\n", n)
#define pfs(n) printf("%d ", n)
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define READ freopen("in.txt", "r", stdin)
#define WRITE freopen("out.txt", "w", stdout)
#define sz size()
#define number_of_digit(n) __builtin_ffs(n);
#define ll long long
#define T int
#define ld long double
inline void print(T n)
{
	if (n == 0)
	{
		putchar('0');
		putchar('\n');
	}
	else if (n == -1)
	{
		putchar('-');
		putchar('1');
		putchar('\n');
	}
	else
	{
		char buf[11];
		buf[10] = '\n';
		int i = 9;
		while (n)
		{
			buf[i--] = n % 10 + '0';
			n /= 10;
		}
		while (buf[i] != '\n')
			putchar(buf[++i]);
	}
}
int read()
{
       int cc = getc(stdin);
       for (;cc < '0' || cc > '9';)  cc = getc(stdin);
       int ret = 0;
       for (;cc >= '0' && cc <= '9';)
       {
          ret = ret * 10 + cc - '0';
          cc = getc(stdin);
       }
      return ret;
}
ll power(ll num,ll g)
{
	if(g==0)return 1;

	if(g%2==1)return (num*power((num*num)%mod,g/2))%mod;
	return power((num*num)%mod,g/2);
}
int main()
{
	ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
  	cout.tie(NULL);

  	int a[4];
  	For(i,4)cin>>a[i];
  	sort(a,a+4);
  	if(a[0]==1 && a[1]==4 && a[2]==7 && a[3]==9)cout<<"YES\n";
  	else cout<<"NO\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    string w1, w2;
    
    cin >> w1 >> w2;
    
    if(w1[0] == w2[2] && w1[1] == w2[1] && w1[2] == w2[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    return 0;
    
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

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

int main() {
    ll N,M;
    cin >> N >> M;
    Yes(N == M);
}

Measured memory_bytes: 3564
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static int[][] directedGraph(int n, int[] from, int[] to) {
		int[] cnt = new int[n];
		for (int i : from) cnt[i]++;

		int[][] g = new int[n][];
		for (int i=0; i<n; i++) g[i] = new int[cnt[i]];
		for (int i=0; i<from.length; i++) {
			int s = from[i];
			int t = to[i];
			g[s][--cnt[s]] = t;
		}

		return g;
	}

	static int[][] g;
	static String[] s;

	static void rec(int cur, int d) {
		for (int i=0; i<d; i++) out.print(".");
		out.println(s[cur]);
		for (int i=g[cur].length-1; i>=0; i--) {
			rec(g[cur][i], d+1);
		}
	}

	static void solve() {
		int n = in.nextInt();

		s = new String[n];
		int[] a = new int[n-1];
		int[] b = new int[n-1];
		for (int i=0; i<n; i++) {
			int k = in.nextInt() - 1;
			s[i] = in.next();
			if (k == -1) continue;
			a[i-1] = k;
			b[i-1] = i;
		}

		g = directedGraph(n, a, b);
		rec(0, 0);
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

int N;
vector<int> P;
void prime(const int N) {
    for(int i = 2; i <= N; i++) {
        bool flag = true;
        for(int j = 2; j * j <= i; j++) {
            if(i % j == 0) {
                flag = false;
                break;
            }
        }
        if(flag) P.emplace_back( i );
    }
}

bool vector_finder(std::vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
  }
  else { // 発見できなかったとき
    return false;
  }
}

int main() {
    // 前準備
    prime(100000 + 5);
    vector<int> near_2017;
    rep(i, P.size()-1) {
      
      if(vector_finder(P, ((P[i]+1)/2))) near_2017.push_back(P[i]);
    }

    int q; cin >> q;
    rep(i, q) {
      int l, r; cin >> l >> r;
      auto l_itr = lower_bound(near_2017.begin(), near_2017.end(), l);
      auto r_itr = upper_bound(near_2017.begin(), near_2017.end(), r);
      auto l_idx = l_itr - near_2017.begin();
      auto r_idx = r_itr - near_2017.begin() - 1; // upper_boundはぎり満たさないやつなので
      cout << r_idx - l_idx + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 768
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N == 3 || N == 5 || N == 7) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define moca(a, s, b) a=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
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;}
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


//for(i=0; i<N; i++) cin >> a[i];


int main(void) {
  ll i, j, k, l;
  
  ll N;
  cin >> N;
  ll a[MAX*2];
  ll cnt[66][66]={};
  
  map<double, ll> mp;
  for(i=0; i<N; i++) {
    double tt;
    cin >> tt;
    a[i]=llround(tt*1e9);
    
    ll t=a[i];
    ll c2=0, c5=0;
    while(t%2==0) {c2++; t/=2;}
    while(t%5==0) {c5++; t/=5;}
    cnt[c2][c5]++;
  }
  
  
  ll ans=0;
  for(i=0; i<66; i++) {
    for(j=0; j<66; j++) {
      for(k=0; k<66; k++) {
        for(l=0; l<66; l++) {
          if(i==k && j==l) continue;
          
          if(i+k>=18 && j+l>=18) {
            ans+=cnt[i][j]*cnt[k][l];
          }
        }
      }
    }
  }
  ans/=2;
  
  for(i=0; i<66; i++) {
    for(j=0; j<66; j++) {
      if(i*2>=18 && j*2>=18) {
        ans+=cnt[i][j]*(cnt[i][j]-1)/2;
      }
    }
  }
  pt(ans);
  
}


Measured memory_bytes: 3824
#include <stdio.h>

int main(void){

  int H,W,h,w;

  while (1){

    scanf("%d %d",&H,&W);

    if (H == 0 && W == 0){
      break;
    }

    for (h = 1;h <= H;h++){
      for (w = 1;w <= W;w++){
	if ((h + w) % 2 == 0){
	  putchar('#');
	} else {
	  putchar('.');
	}
      }
      putchar('\n');
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 576
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
const int INF=1001001001;

int main() {
  int X,N;
  cin>>X>>N;
  vector<bool>ok(101,true);
  for(int i=0;i<N;i++){
    int p;
    cin>>p;
    ok[p]=false;
  }
  int MIN=1e9,ans=1e9;
  for(int i=0;i<=101;i++){
    if(ok[i]&&abs(i-X)<MIN){MIN=abs(i-X);ans=i;}
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3568
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception{
		new Main(new Scanner(System.in), System.out, System.err).exec();
	}
	public final Scanner sc;
	public final PrintStream out, err;
	public Main(final Scanner sc, final PrintStream out, final PrintStream err) {
		this.sc = sc;this.out = out;this.err = err;
	}
	static public final long pair(int a, int b) {return (((long)a) << 32) + b;}
	static public final int getPair1(long v) {return (int)(v >> 32);}
	static public final int getPari2(long v) {return (int)(v & 0xFFFFFFFF);}

	static public final long quad(long a, long b, long c, long d) {
		return ((a&0xFFFF)<< 48) + ((b&0xFFFF)<< 32) + ((c&0xFFFF)<< 16) +(d&0xFFFF);}
	static public final int getQuad1(long v) {return (int)( v >> 48          );}
	static public final int getQuad2(long v) {return (int)((v >> 32) & 0xFFFF);}
	static public final int getQuad3(long v) {return (int)((v >> 16) & 0xFFFF);}
	static public final int getQuad4(long v) {return (int)( v        & 0xFFFF);}

	static public final long record(int e, int m, int i) {
		return quad(-1, e, m, i);
	}
	static public final int re(long record) {
		return getQuad2(record);
	}
	static public final int rm(long record) {
		return getQuad3(record);
	}
	static public final int ri(long record) {
		return getQuad4(record);
	}

	//------------------------------------------

	private int p;
	private int[] inv;
	private int[] fact;
	private int[] finv;
	public final int mod(long v) {
		v %= p;
		return (int)(v < 0 ? v+p : v);
	}
	public final int mul(long a, long b) {
		return mod(a*b);
	}
	public final void initFact(double limit, double p) {
		initFact((int)limit, (int)p);
	}
	public final void initFact(int limit, int p) {
		this.p = p;
		this.inv = new int[limit+1];
		this.fact = new int[limit+1];
		this.finv = new int[limit+1];
		fact[1] = finv[1] = inv[0] = inv[1] = 1;
		for(int i=2;i<=limit;i++) {
			int a = p / i;
			int b = p % i;
			inv[i]  = mul(-a, inv[b]);
			fact[i] = mul(fact[i-1], i);
			finv[i] = mul(finv[i-1], inv[i]);
		}
	}
	public final int comb(int m, int n) {
		return mul(mul(fact[m], finv[n]), finv[m-n]);
	}
	//------------------------------------------
	static long lcm (long a, long b) {
		long temp;
		long c = a;
		c *= b;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return (long)(c/b);
	}

	//------------------------------------------



	public void exec() throws Exception{
		final int H = sc.nextInt();
		final int A = sc.nextInt();
		int x = H / A;
		if((H%A)!=0) {
			x++;
		}
		out.println(x);
	}
}


Measured memory_bytes: 21844
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>

using namespace std;

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

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

    vector<double> q(n);
    for (int i = 0; i < n; i++) {
        q[i] = static_cast<double>(p[i] * (p[i] + 1)) / (2 * p[i]);
    }

    for (int i = 1; i < n; i++) {
        q[i] += q[i - 1];
    }

    double res = static_cast<double>(q[k - 1]);
    for (int i = k; i < n; i++) {
        res = max(res, static_cast<double>(q[i] - q[i - k]));
    }

    cout << setprecision(12) << fixed << res << endl;
}


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

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

    int s_size = s.size() / 2;
    int hug_counter = 0;
    for (int i=0;i<s_size;i++){
        if (s[i] != s[s.size() - 1 - i]){
            hug_counter++;
        }
    }
    cout << hug_counter << endl;
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i = 0; i < (int)(n); i++)

vector<bool> one(10,0);
vector<bool> two(10*10,0);
vector<bool> three(10*10*10,0);

ll solve(const int N, const string &S) {

  for(int i = 0; i < N; i++) {
    int cur = S[i] - '0';
    REP(i,100) {
      three[i*10+cur] = three[i*10+cur] || two[i];
    }
    REP(i,10) {
      two[i*10+cur] = two[i*10+cur] || one[i];
    }
    one[cur] = true;
  }
  ll ans = 0;
  REP(i, three.size()) {
    ans += three[i];
    //    if(three[i]) cout << i << "=" << three[i] << endl;
  }
  return ans;
}

int main() {
  int N; cin>>N;
  string S; cin>>S;
  ll ret = solve(N, S);
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

MOD = 10 ** 9 + 7

N, K = map(int, readline().split())
A = list(map(int, readline().split()))

tento1 = 0
for i in range(N):
    for j in range(i+1, N):
        if A[i] > A[j]:
            tento1 += 1
tento2 = 0
for i in range(N):
    for j in range(0, N):
        if A[i] > A[j]:
            tento2 += 1

ans = K * tento1 + (K * (K - 1)) // 2 * tento2
ans = ans % MOD
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <queue>
#include <sstream>
#include <cmath>
#include <functional>
#include <climits>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cerr << __FILE__ << ":" << __LINE__ << endl;
#define INF 2147483647

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
        // setw(6) << setfill('0')
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const pair<_K, _V>& v) {
    ostr << "(" << v.first << ", " << v.second << ")";
    return ostr;
}

int64 powmod(int64 n, int64 count, int64 mod) {
    if (count == 0) return 1;
    if (count % 2 == 0) {
        int64 t = powmod(n, count / 2, mod);
        return t * t % mod;
    }
    return n * powmod(n, count - 1, mod) % mod;
}

int64 ncr(int64 n, int64 r, int64 mod) {
    int64 a;
    if (n < r) a = min(n, r - n);
    else a = min(n - r, r);

    int64 res = 1;
    rep(i, a) {
        res = res * (n - i) % mod;
        res = res * powmod(i + 1, mod - 2, mod) % mod;
    }

    return res;
}

int main() {
    string S; cin >> S;
    string p[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};

    rep(i, 7) {
        if (p[i] == S) {
            cout << 7 - i << endl;
            exit(0);
        }
    }
}


Measured memory_bytes: 256
N = int(input())
n = input()    
m = n.split()
p = [int(i) for i in m]
list = 1
for i in range(N-1):
    list = (list * (i+1)) % 1000000007

def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)

# ax ≡ 1 (mod m)
def modinv(a, m):
    (inv, q, gcd_val) = egcd(a, m)
    return inv % m

A = 0
for i in range(N-1):
    if i == 0:
        A = (A + list * (p[N-1]-p[i])) % 1000000007
    else:
        A = (A + list * (p[N-1]-p[i]) * modinv(i+1,1000000007)) % 1000000007
print(A)

Measured memory_bytes: 15192
#include <iostream>
#include <cmath>
using namespace std;
inline long long GetDigit(long long num) {
	return (long long)(log10(num) + 1);
}

inline long long F(long long A, long long B) {
	long long x = GetDigit(A), y = GetDigit(B);
	return (x > y) ? x : y;
}

int main() {
	long long N;
	cin >> N;
	
	long long min = 10000000;

	for (int i = 1; i <= sqrt(N); i++)
	{
		if (N%i != 0) {
			continue;
		}
		else {
			if (min > F(i, N / i)) {
				min = F(i, N / i);
			}
		}
	}


	cout << min << endl;

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
using namespace std;
//#define int long long
map <int, int> mmm;
signed main() {
#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		int cur;
		cin >> cur;
		mmm[cur]++;
	}
	vector <int> v;
	for (auto it : mmm) {
		if (it.second > 1) v.push_back(it.first);
		if (it.second > 3) v.push_back(it.first);
	}
	if (v.size() < 2) return 0 * printf("0");
	cout << 1LL * v.back() * v[v.size() - 2] << endl;
}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int d = a / b;
		int r = a % b;
		double f = (double)a / (double)b;
		System.out.println(d + " " + r + " " + String.format("%8f",f));
	}
}


Measured memory_bytes: 26500
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
bool sub() {
  int n;
  cin >> n;
  set<string> st;
  string s;
  cin >> s;
  string prev = s;
  st.insert(s);
  while (--n) {
    cin >> s;
    if (st.count(s)) return false;
    if (prev.back() != s.front()) return false;
    prev = s;
    st.insert(s);
  }
  return true;
}

int main() {
  cout << (sub() ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        int n;
        long long ans=0;
        scanf("%d",&n);
        vector<long>ar(n);
        for(auto&e:ar){
                scanf("%ld",&e);
        }
        sort(ar.begin(),ar.end());
        for(int i=0;i<n;i++){
                ans+=ar[i];
        }
        printf("%ld %ld %lld\n",ar[0],ar[n-1],ans);
        return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector <string> S(200010);

  int counter = 0;

  for(int i=0; i<N; i++){
    cin >> S.at(i);
  }
  sort(S.begin(),S.end());
  reverse(S.begin(),S.end());
  for(int i=0;i<N-1;i++){
    if(S.at(i)!=S.at(i+1)){
      counter++;
    }
  }

  cout << counter+1 << endl;

}


Measured memory_bytes: 9592
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define dd(x) cout<<#x<<"="<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x7f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PI acos(-1.0)
const int mod = 1e9+7;
const int maxn = 1e3+5;
const double EPS = 1e-6;
using namespace std;
int gcd(int a,int b){
	return b==0?a:gcd(b,a%b);
}
map<int,int> mp;
int main()
{
	int n;
	scanf("%d",&n);
	int a;
	rep(i,0,n) {
		scanf("%d",&a);
		mp[a]++;
	}
	map<int,int>::iterator it;
	int ans = 0;
	for(it=mp.begin();it!=mp.end();++it){
		if(it->fi>it->se) ans += it->se;
		else if(it->fi<it->se) ans += it->se-it->fi;
	} 
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

char s[52][52];
int h,w;

bool check(int i, int j){
    if( s[i-1][j]=='#' || s[i][j-1]=='#' || s[i][j+1]=='#' || s[i+1][j]=='#' ){
            return true;
        }else{
            return false;
        }
}

int main(){

    int flag=0;
    int count = 0;
    cin >> h >> w;

    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            s[i][j] = '.';
        }
    }

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> s[i+1][j+1];
            if(s[i+1][j+1]=='#') count++;
        }
    }

    if(count != 0){
        for(int i=1;i<=h;i++){
            for(int j=1;j<=w;j++){
                if(s[i][j]=='#'){
                    if(!check(i,j)){
                        cout << "No" << endl;
                        return 0;
                    }
                }
            }
        }
    }
    cout << "Yes" << endl;


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include<stdio.h>
#include <functional>
#include<algorithm>
#define PI 3.14159265
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define SZ(x) ((int)(x).size())

using namespace std;



int main() {
	ll n, a, b;
	ll ans=0;
	cin >> n >> a >> b;
	ll x[100000];
	REP(i, n) cin >> x[i];
	REP(i, n-1) {
		if ((x[i + 1] - x[i])*a > b) {
			ans += b;
		}
		else {
			ans += (x[i + 1] - x[i])*a;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

const K: usize = 20;

fn main() {
    let n: usize = read();
    let a: Vec<usize> = readnc();
    let mut next_one: Vec<Vec<usize>> = vec![vec![n; n+1]; K];

    for k in 0..K {
        let ptn = 1<<k;
        let mut last_one = n;
        for i in (0..n).rev() {
            next_one[k][i] = last_one;
            if a[i] & ptn == ptn {
                last_one = i;
            }
        }
    }

    let mut ans: i64 = 0;
    for i in 0..n {
        let mut min_to_fail = n;
        for k in 0..K {
            if (a[i] & (1<<k)) == 1<<k {
                min_to_fail = min(min_to_fail, next_one[k][i]);
            } else {
                min_to_fail = min(min_to_fail, next_one[k][next_one[k][i]]);
            }
        }
        let size = (min_to_fail - i) as i64;
        ans += size;
    }
    println!("{}", ans);
}


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

int main() {
    string a,b;  cin>>a>>b;
    bool flag=true;
    for(int i=0; i<3; i++) {
        if(a[i]!=b[2-i]) {
            flag=false;
            break;
        }
    }
    flag? cout<<"YES"<<endl: cout<<"NO"<<endl;
}


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

using namespace std;
int main() {
    string s;
    int len;

    cin >> s;
    len = s.length();

    for (int i = 2; 0 <= len-i; i += 2) {
        bool found = true;
        for (int j = 0; j < (len-i)/2; j++) {
            if (s[j] != s[(len-i)/2+j]) {
                found = false;
                break;
            }
        }
        if (found) {
            cout << (len - i) << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll x;cin>>x;
  if(x>=1800)
    cout<<1;
  else if(x>=1600 && x<=1799)
    cout<<2;
  else if(x>=1400 && x<=1599)
    cout<<3;
  else if(x>=1200 && x<=1399)
    cout<<4;
  else if(x>=1000 && x<=1199)
    cout<<5;
  else if(x>=800 && x<=999)
    cout<<6;
  else if(x>=600 && x<=799)
    cout<<7;
  else if(x<=599)
    cout<<8;
}

Measured memory_bytes: 3608
/*
Wai u read my code xD
*/
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vi vector <ll> 
#define qu queue <ll>
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;


void solve()
{
    int n; cin >> n;
    int a[2*n]; for (int i = 0; i < 2*n; i++) cin >> a[i];
    sort(a, a+(2*n)); int ans = 0;
    for (int i = 0; i < 2*n; i+=2) ans+=a[i];
    nout(ans);
}

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

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

#define ll long long

int main()
{
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i].first >> v[i].second;
    }
    sort(v.begin(), v.end());

    ll ans = 0, ind = 0;
    while (m)
    {
        int amt = min(m, v[ind].second);
        m -= amt;
        v[ind].second -= amt;
        ans += amt * v[ind].first;
        if (!v[ind].second) ind++;
    }

    cout << ans << "\n";
}

Measured memory_bytes: 4772
#include <bits/stdc++.h>
using namespace std;
int main() {
 int a;
   cin >>a;
  int d[a];
  for(int i=0;i<a;i++){
  cin >> d[i];
  }
  sort(d, d+a);
  if(d[a]==d[a/2-1]){
    cout << "-1" << endl;
  }
    else{
      cout << d[a/2]-d[a/2-1] << endl;
    }
}


Measured memory_bytes: 640
use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let input = read_line().split_whitespace().map(|x|x.parse::<i64>().unwrap()).collect::<Vec<i64>>();
    let mut N = input[0];
    let K = input[1];

    let mut count:i64 = 0;

    loop {
        if N >= K {
            N = N/K;
            count+=1;
        }else{
            break;
        }
    }

    println!("{}",count+1);
}



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

int main(void)
{
	int N;
	cin>>N;
	int forth = 0 , two = 0;
	long long int a ;
	for(int i = 1 ; i <= N ; i++ )
	{
		cin>>a;
		if(a % 4 == 0)
		{
			forth ++;
		}else if (a %2 == 0)
		{
			two++;
		}
	}
	
	if(forth * 2 + two >=N || forth * 2 +1 == N)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0; 
	
	
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        Set<Long> a = new HashSet<>();
        for (int i = 0; i < n; i++) {
            Long aa = sc.nextLong();
            a.add(aa);
        }

        String result = "YES";
        if (a.size() != n) {
            result = "NO";
        }

        System.out.println(result);
    }
}

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

void main()
{
    int N, X, T;

    scanf("%d %d %d", &N, &X, &T);

    if(!((N >= 1) && (N <=1000))){
        return;
    }
    if(!((X >= 1) && (X <=1000))){
        return;
    }
    if(!((T >= 1) && (T <=1000))){
        return;
    }

    int Z;

    Z = ((N / X) + (((N % X)!=0)?1:0)) * T;

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


Measured memory_bytes: 1680
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>


using namespace std;

int main()
{
    int n,m;
    cin >>n;
    cin >>m;
    vector<int> vec(m);
    
    for(int i=0;i<m;++i){
        cin >> vec[i];
    }
    int sum=0;
    for(int j=0;j<m;j++){
        sum+=vec[j];
    }
    if(n<sum){
        cout<<"-1";
    }else{
        cout<<n-sum;
    }
}
    






Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int N,K,x,c=0;
  cin>>N>>K;
  for(int i=0;i<N;i++){
    cin>>x;
    if(x>=K)c++;
  }
  cout<<c<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
const int INF = 1e8;
using namespace std;

int main(){
    int n;
    cin >> n;
    n--;

    long long a[105], ans;
    rep(i,n) cin >> a[i];
    cin >> ans;

    long long dp[25][105] = {{0}}; //テヲツ閉ーテ・ツ?、テ」ツ??ゥツ?堙」ツつ?
    dp[a[0]][0] = 1;
    range(i,1,n){
        rep(j,21){
            //if(dp[j][i - 1] == 0) continue;
            if(j - a[i] >= 0){
                dp[j - a[i]][i] += dp[j][i - 1];
            }
            if(j + a[i] <= 20){
                dp[j + a[i]][i] += dp[j][i - 1];
            }
        }
        //rep(j,21){ cout << dp[j][i]<<' '; } cout << endl;
    }

    cout << dp[ans][n - 1] << endl;
}

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

int main() {
	int n;
	scanf("%d", &n);
	bool flag=false;
	for (int i=1; i<10; i++) 
		for (int j=1; j<10; j++) 
			if (i*j==n) 
				flag=true;
	
	if (flag) printf("Yes\n");
	else printf("No\n");
	
	return 0;
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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


const string YES = "Yes";
const string NO = "No";

void func(long long N, std::vector<long long> a){

    lli ans = 0;
    REP(i,0,N)ans ^= a[i];

    if(ans==0)cout<<YES<<endl;
    else cout<<NO<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    func(N, std::move(a));
    return 0;
}


Measured memory_bytes: 4036
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<limits>

using namespace std;

int main(){
  int lmax = numeric_limits<int>::min(), rmin = numeric_limits<int>::max();
  int n, m; cin >> n >> m;

  int l, r;
  for(int i=0; i<m; ++i){
    cin >> l >> r;

    lmax = lmax < l ? l : lmax;
    rmin = rmin > r ? r : rmin;
  }

  cout << (rmin - lmax + 1 > 0 ? rmin - lmax + 1 : 0) << endl;
}



Measured memory_bytes: 256