akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define pf push_front
#define loop(i, n) for(int i = 0 ; i < n ; ++i)
#define LOOP(i, a, b) for(int i = a ; i < b ; ++i)
#define max3(a, b, c) max(a, max(b,c))
#define max4(a, b, c, d) max3(a, b, max(c, d))
#define ff first
#define ss second
#define mkp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vii vector<pii>
#define vvii vector<vii>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define nmbr(c) (int)(c-'0')
#define ltr(c) (int)(c-'a')
#define INF 1e18
#define inf 1e9
#define MOD 1000000007 //check
#define _69e27 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int n;
long double dp[3001][3001], p[3000];
bool dpb[3001][3001];

long double prb(int i, int h)
{
	if(i == n) return (2*h > n);
	long double &ans = dp[i][h];
	if(dpb[i][h]) return ans;
	dpb[i][h] = 1;
	return ans = p[i]*prb(i+1, h+1) + (1-p[i])*prb(i+1, h);
}
int main() {
	_69e27;
	memset(dpb, 0, sizeof(dpb));
	cin >> n;
	loop(i, n) cin >> p[i];
	cout << fixed << setprecision(10) << prb(0, 0);
	return 0;
}

Measured memory_bytes: 150016
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int one = 0;
        int two = 0;
        int three = 0;

        double[][][] dp = new double[n+100][n+100][n+100];

        for (int i=0; i<n; i++) {
            int t = sc.nextInt();
            if (t == 1) one++;
            if (t == 2) two++;
            if (t == 3) three++;
        }

        for (int i=0; i<=n; i++) {
            for (int j=0; j<=n; j++) {
                for (int k=0; k<=n; k++) {
                    if (i == 0 && j == 0 && k == 0) continue;
                    double sum = i + j + k, p = n / sum;
                    if (0 < k) dp[k][j][i] += dp[k-1][j][i] * k / sum;
                    if (0 < j) dp[k][j][i] += dp[k+1][j-1][i] * j / sum;
                    if (0 < i) dp[k][j][i] += dp[k][j+1][i-1] * i / sum;
                    dp[k][j][i] += p;
//                    dp[i][j][k] += n;
//                    dp[i][j][k] /= (double) (i + j + k);
                }
            }
        }

//        for (int i=0; i<=n; i++) {
//            for (int j=0; j<n; j++) {
//                for (int k=0; k<n; k++) {
//                    if (i == 0 && j == 0 && k == 0) continue;
//                    double sum = i + j + k, p = n / sum;
//                    if (0 < i) dp[i][j][k] += dp[i-1][j+1][k] * i / sum;
//                    if (0 < j) dp[i][j][k] += dp[i][j-1][k+1] * j / sum;
//                    if (0 < k) dp[i][j][k] += dp[i][j][k-1] * k / sum;
//                    dp[i][j][k] += p;
//                }
//            }
//        }




//        System.out.println(res);

//        System.out.println(dp[three][two][one]);
        System.out.println(dp[one][two][three]);



    }

}



Measured memory_bytes: 757548
from collections import Counter
n=int(input())
balls=[]
distance=[]
if n==1:
  print(1)
else:
  for i in range(n):
    balls.append(list(map(int,input().split())))
    balls.sort(key=lambda x:x[0]+x[1])
  for i in range(n-1):
    for j in range(i+1,n):
      distance.append(str(balls[i][0]-balls[j][0])+","+str(balls[i][1]-balls[j][1]))
  d=Counter(distance)
  print(n-d.most_common()[0][1])


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

int main(){
  int n;
  cin >> n;
  vi l(n);
  rep(i,n) cin >> l[i];
  sort(l.begin(),l.end());
  ll ans = 0;
  for(int a=n-1; a>1; a--){
    for(int b=a-1; b>0; b--){
      int dif = l[a]-l[b];
      int left = -1, right = b;
      while(right-left>1){
        int mid = (left+right)/2;
        if(l[mid] > dif) right = mid;
        else left = mid;
      }
      ans += b-right;
      //cout << right << endl;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3620
import std.functional,
       std.algorithm,
       std.container,
       std.typetuple,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv,
       std.format,
       std.math;

void main()
{
	auto r = readln.chomp.to!int;
	auto g = readln.chomp.to!int;
	writeln(2*g-r);
}

Measured memory_bytes: 256
n,m=map(int,input().split())
gazoa=[0 for i in range(n)]
gazob=[0 for j in range(m)]
for i in range(n):
    s=input()
    gazoa[i]=s
for j in range(m):
    s=input()
    gazob[j]=s
flag=False
for i in range(n-m+1):
    #縦から上から1番目　そして2番目　そして。。。。という感じでn-m+1番目までについてのスタート地点を決める
    for k in range(n-m+1):
        realflag=True
        #k=0,1,2,....n-mという感じになる
        for num in range(m):
            if gazoa[i+num][k:k+m]!=gazob[num]:
                realflag=False
        if realflag:
            flag=True
if flag:
    print("Yes")
        
        
else:
    print("No")
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
const int N = 2e5 + 54;
int X, Y, A, B, C, a[N], b[N], c[N], v[N], tot;
long long ans;
int main() {
	std::cin >> X >> Y >> A >> B >> C;
	for (int i = 1; i <= A; ++i) std::cin >> a[i];
	for (int i = 1; i <= B; ++i) std::cin >> b[i];
	for (int i = 1; i <= C; ++i) std::cin >> c[i];
	std::sort(a + 1, a + A + 1); std::reverse(a + 1, a + A + 1);
	std::sort(b + 1, b + B + 1); std::reverse(b + 1, b + B + 1);
	std::sort(c + 1, c + C + 1); std::reverse(c + 1, c + C + 1);
	for (int i = 1; i <= X; ++i) v[++tot] = a[i];
	for (int i = 1; i <= Y; ++i) v[++tot] = b[i];
	std::sort(v + 1, v + tot + 1);
	int i = 1, j = 1;
	while (i <= tot && j <= C) {
		if (c[j] > v[i]) v[i] = c[j], ++i, ++j;
		else break;
	}
	for (int i = 1; i <= tot; ++i) ans += v[i];
	std::cout << ans << '\n';
}


Measured memory_bytes: 2176
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

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


Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}

ll gcd(ll a,ll b){
  while(b!=0){
    a%=b;
    swap(a,b);
  }
  return a;
}

//BEGIN CUT HERE

template<typename T>
T extgcd(T a,T b,T &x,T &y){
  T d=a;
  if(b!=0){
    d=extgcd(b,a%b,y,x);
    y-=(a/b)*x;
  }else{
    x=1;
    y=0;
  }
  return d;
}

template<typename T>
T mod_inverse(T a,T mod){
  T x,y;
  extgcd(a,mod,x,y);
  return (mod+x%mod)%mod;
}

template<typename T>
pair<T, T> linear_congruence(const vector<T> &A,
                             const vector<T> &B,
                             const vector<T> &M){
  T x=0,m=1;
  for(int i=0;i<(int)A.size();i++){
    T a=A[i]*m,b=B[i]-A[i]*x,d=__gcd(M[i],a);
    if(b%d!=0) return make_pair(0,-1);
    T t=b/d*mod_inverse(a/d,M[i]/d)%(M[i]/d);
    x=x+m*t;
    m*=M[i]/d;
  }
  return make_pair((x%m+m)%m,m);
}
//END CUT HERE

//BEGIN CUT HERE
template<typename T>
T totient(T n){
  T res=n;
  for(T i=2;i*i<=n;i++){
    if(n%i==0){
      res=res/i*(i-1);
      for(;n%i==0;n/=i);
    }
  }
  if(n!=1) res=res/n*(n-1);
  return res;
}
//END CUT HERE

ll mod_pow(ll a,ll x,ll mod){
  ll ret=1;
  a%=mod;
  while(x>0){
    if(x&1){
      (ret*=a)%=mod;
    }
    (a*=a)%=mod;
    x>>=1;
  }
  return ret;
}

int main(){
  ll N,tmp;
  cin>>N;
  tmp=N;
  vector<ll> P;
  for(ll i=2;i*i<=tmp;i++){
    while(tmp%i==0){
      if(!P.empty() && P.back()==i){
        cout<<-1<<endl;
        return 0;
      }
      P.push_back(i);
      tmp/=i;
    }
  }
  if(tmp!=1){P.push_back(tmp);}
  vector<ll> A,B,M;
  ll ans=1;
  for(auto &I:P){
    if(I-1==1){continue;}
    if(gcd(N,I-1)!=1){
      cout<<-1<<endl;
      return 0;
    }
    ll phi=totient(I-1);
    ll mi=phi;
    if(mod_pow(N,phi,I-1)!=1){
      cerr<<N<<" "<<phi<<" "<<I-1<<" "<<mod_pow(N,phi,I-1)<<endl;
    }
    assert(mod_pow(N,phi,I-1)==1);
    for(ll i=1;i*i<=phi;i++){
      if(phi%i==0){
        if(mod_pow(N,i,I-1)==1){mi=min(mi,i);}
        if(mod_pow(N,phi/i,I-1)==1){mi=min(mi,phi/i);}
      }
    }
    ans=ans/gcd(ans,mi)*mi;
  }
  cout<<ans<<endl;
  
  
  return 0;
}



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

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

    int cnt = 0;
    for(int i = 0; i < 2; i++) {
        if(a >= b) {
            cnt += a;
            a--;
        } else {
            cnt += b;
            b--;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)   __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)   __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)   __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define ll long long
#define pb push_back
#define PI M_PI
#define endl "\n"
#define sc scanf
#define pf printf
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int main()
{
     IOS
     int i,j,n,k,x,y;

     cin>>n>>k;
     map<int,int> mp;
     while(k--)
     {
          cin>>x;
          while(x--)
          {
               cin>>y;
               mp[y]++;
          }
     }
     cout<<n-mp.size()<<endl;

     return 0;
}



Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = ReadLine();
            int candInd;
            int mindelta =1000;
            for (int  i = 0;i <= s.Length-3;i++)
            {
                string tmp = "";
                for (int j = i; j < i + 3; j++)
                    tmp += s[j];
                int d = 753 - int.Parse(tmp);
                d = Math.Abs(d);
                if (mindelta > d)
                {
                    mindelta = d;
                    candInd = i;
                }
            }
            WriteLine(mindelta);

        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
// typedef pair<ll,ll> Pair;
// int mod=1000000007;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    ll t,c,h,i,j,k,temp,temp2,n,m;
    string a,b,tem;
    cin >> a >> b >> i >> j >> tem;
    if(tem==a) i--;
    else j--;
    cout << i  << " " << j; 
}

Measured memory_bytes: 256
import sys

l=input().split()

A=int(l[0])
B=int(l[1])
K=int(l[2])

i=0
for i in range(A,A+K):
	if(i==B+1):
		break
	print(i)

if(i>=B-K+1):
	i+=1
	while i<=B:
		print(i)
		i+=1
else:
	i=B-K+1
	while i<=B:
		print(i)
		i+=1

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

int main() {
    int k, a, b;
    cin >> k >> a >> b;
    for(int i = a; i <= b; i++) {
        if(i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}


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

int main(){
  string S,T;
  cin >> S >> T;
  int a,b;
  cin >> a >> b;
  string U;
  cin >> U;
  if(S==U){
    cout << a-1 << " " << b << endl;
  }else{
    cout << a << " " << b-1 << endl;
  }
  return 0;
}


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

int main() {
	int N; cin >> N;
	int a=0, b, c, d;
	for(int i=0; i<N; ++i){
	    cin >> c >> d;
	    if(a<c){
	        a=c;
	        b=d;
	    }
	}
	cout << a+b << endl;
	return 0;
}


Measured memory_bytes: 256
store_num, needed_drink_num = tuple(int(i) for i in input().split(" "))
drink_list = []
for i in range(store_num):
    drink_list.append(tuple(int(i) for i in input().split(" ")))


def tuple_index_0(tup):
    return tup[0]


drink_list.sort(key=tuple_index_0)
ans = 0
for i in drink_list:
    if i[1] < needed_drink_num:
        needed_drink_num -= i[1]
        ans += i[0] * i[1]
    else:
        ans += i[0] * needed_drink_num
        print(ans)
        break


Measured memory_bytes: 18120
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cctype>
#include<algorithm>
#include<cstring>
#include<iomanip>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<vector>
#include<stack>
#include<cmath>
#include<random>
//This code is written by Itst
using namespace std;

inline int read(){
    int a = 0;
    char c = getchar();
    bool f = 0;
    while(!isdigit(c) && c != EOF){
        if(c == '-')
            f = 1;
        c = getchar();
    }
    if(c == EOF)
        exit(0);
    while(isdigit(c)){
	a = a * 10 + c - 48;
        c = getchar();
    }
    return f ? -a : a;
}

int d[12][12] , f[107][107];

signed main(){
    int A = read() , B = read();
    for(int i = 1 ; i <= A ; ++i)
	for(int j = 1 ; j <= B ; ++j)
	    d[i][j] = read();
    for(int i = 0 ; i <= 100 ; ++i)
	for(int j = 0 ; j <= 100 ; ++j)
	    for(int p = 1 ; p <= A ; ++p)
		for(int q = 1 ; q <= B ; ++q)
		    f[i][j] = max(f[i][j] , d[p][q] - i * p - j * q);
    for(int i = 1 ; i <= A ; ++i)
	for(int j = 1 ; j <= B ; ++j){
	    int minN = 1e9;
	    for(int p = 0 ; p <= 100 ; ++p)
		for(int q = 0 ; q <= 100 ; ++q)
		    minN = min(minN , f[p][q] + p * i + q * j);
	    if(minN != d[i][j]){
		puts("Impossible");
		return 0;
	    }
	}
    puts("Possible");
    puts("202 10401");
    for(int i = 1 ; i <= 100 ; ++i)
	printf("%d %d X\n" , i , i + 1);
    for(int i = 102 ; i < 202 ; ++i)
	printf("%d %d Y\n" , i , i + 1);
    for(int i = 0 ; i <= 100 ; ++i)
	for(int j = 0 ; j <= 100 ; ++j)
	    printf("%d %d %d\n" , 1 + i , 202 - j , f[i][j]);
    puts("1 202");
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ll inf = 1LL << 60;
const ld pi = (acos(-1));
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; }

float dis(vector<int> a,vector<int> b){
   float distance=0;
   for(int i=0;i<a.size();i++){
     distance+=(a[i]-b[i])*(a[i]-b[i]);
   }
   return distance;
}


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  int n,d; cin >> n >> d;
  vector<vector<int>> x(n,vector<int>(d));
  int ans=0;
  set<int> s;
  rep(i,1,100001) s.emplace(i*i);
  rep(i,0,n)rep(j,0,d) cin >> x[i][j];
  rep(i,0,n)rep(j,i+1,n){
    int d = dis(x[i],x[j]);
    if(s.count(d)) ans++;
  }
  cout << ans << endl;
}

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

using namespace std;

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

    int n;
    string s;
    cin >> n >> s;
    int e[n + 1], w[n + 1], ans = 2e9;
    e[0] = w[0] = 0;

    for (int i = 0; i < n; i++) {
        e[i + 1] = e[i] + (s[i] == 'E');
        w[i + 1] = w[i] + (s[i] == 'W');
    }

    for (int i = 0; i < n; i++)
        ans = min(ans, w[i] + e[n] - e[i + 1]);

    cout << ans << '\n';

    return 0;
}


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

constexpr int mod = 1e9 + 7;

// int64_t dp[334][334][334];
vector<vector<int64_t>> dp(334, vector<int64_t>(334, 0));

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

  dp[n - 1][1] = 1;
  for (int i = 0; i < m; ++i) {
    vector<vector<int64_t>> dp2(334, vector<int64_t>(334, 0));
    for (int j = 0; j < n; ++j) {
      for (int k = 1; k <= n; ++k) {
        (dp2[j][n - j] += k * dp[j][k] % mod) %= mod;
        if (j) (dp2[j - 1][k] += j * dp[j][k] % mod) %= mod;
        (dp2[j][k] += (n - j - k) * dp[j][k]) %= mod;
      }
    }
    dp = dp2;
  }

  cout << dp[0][n] << endl;
}


Measured memory_bytes: 2072
import java.util.*;
import java.util.Collections;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    int A = sc.nextInt();
    int B = sc.nextInt();
    String U = sc.next();
    sc.close();
    if (S.equals(U)) {
      A -= 1;
      System.out.println(A + " " + B);
    } else {
      B -= 1;
      System.out.println(A + " " + B);
    }
  }
}


Measured memory_bytes: 21844
//arc095_d.cpp
//Sat Aug 25 16:36:55 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

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

	sort(a,a+n);

	int ans = a[n-2];
	for (int i=n-3;i>=0;i--){
		if (abs(a[n-1]/2-a[i])<abs(a[n-1]/2-ans)){
			ans = a[i];
		}
	}

	cout << a[n-1] << " " << ans << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#define N 100000
#define Q 50000

int main(){
  int n, q, i, j, count = 0, a[N], b[Q], left, right, mid;

  scanf("%d", &n);
  for(i = 0;i < n;i++){
    scanf("%d", &a[i]);
  }
  scanf("%d", &q);
  for(i = 0;i < q;i++){
    scanf("%d", &b[i]);
  }
  for(i = 0;i < q;i++){
    left = 0;
    right = n;
    while(left < right){
      mid = (left + right) / 2;
      if(b[i] == a[mid]){
	count++;
	break;
      }
      if(b[i] > a[mid]){
	left = mid + 1;
      }
      else if(b[i] < a[mid]){
	right = mid;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}

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

using namespace std;

#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define t_times int t; cin >> t; while(t--)
#define _parr(a, n) for(int __i = 0; __i < (int )n; __i++) cout << a[__i] << ' '; cout << '\n'
#define fr(i, p, n) for(int i = (int )p; i < (int )n; i++)
#define frn(i, p, n) for(int i = (int )p; i <= (int )n; i++)
#define rev(i, n, p) for(int i = (int )n; i >= (int )p; i--)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).begin(), (c).end()
#define sci(n) scanf("%d", &n)
#define scl(n) scanf("%lld", &n)
#define prin(n) printf("%d\n", n)
#define prln(n) printf("%lld\n", n)
#define mp make_pair
#define F first
#define S second
#define pb push_back

typedef long long int LL;
typedef unsigned long long ULL;
typedef unsigned int uint;
typedef pair< int, int> ii;
typedef vector< int> vi;

const int mod = 1e9 + 7;
const LL INF = 9e18 + 2e17;
const int inf = 2e9;
const int N = 2e5 + 22;
const double eps = 1e-10;

int n, m;

void _solve() {
	string s;
	cin >> s;
	cout << (char )(s[0] + 1) << '\n';
}

int main() {
    fastio;
    //t_times
    _solve();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int P, Q, R;
    int time;
    int times[6];

    scanf("%d %d %d", &P, &Q, &R);
    time = P+Q+R;

    times[0] = P+Q;
    times[1] = R+Q;
    times[2] = P+R;
    times[3] = Q+R;
    times[4] = R+P;
    times[5] = Q+P;

    for (int i = 0; i < 5; i++){
        if(times[i] < time){
            time = times[i];
        }
    }

    printf("%d\n", time);
    return 0;
}

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

bool cmp(int x,int y){
	return x<y;	
}
int main(){
	int a[101],n;
	while(cin>>n){
		for(int i=1; i<=n; ++i)cin>>a[i];
		sort(a+1,a+n+1,cmp);
		int A = 0,B = 0,res;
		if(n & 1){
			for(int i=1; i<=n-1; i+=2){
				A += a[i];
				B += a[i+1];
			}
			res = A + a[n] - B;
		}
		else{
			for(int i=1; i<=n; i+=2){
				A += a[i];
				B += a[i+1];
			}
			res = A - B;

		}
		cout<<abs(res)<<endl;
	}
	return 0;	
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


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

    int x,y;
    cin>>x>>y;
    if(x%y==0){
        fin(-1);
    }
    else{
        cout<<x<<endl;
    }

    

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

const int N = 2005;
vector <int> A;
int dp[N][N][2];
int n;
int func(int id, int p, int turn) {
	if(id == n) {
		return abs(A[n] - A[p]);
	}
	if(dp[id][p][turn] != -1)
		return dp[id][p][turn];
	if(turn == 0) {
		return dp[id][p][turn] = max(func(id + 1, p, turn), func(id + 1, id, turn ^ 1));
	}
	else {
		return dp[id][p][turn] = min(func(id + 1, p, turn), func(id + 1, id, turn ^ 1));
	}
}
int main() {
	int Z, W;
	cin >> n >> Z >> W;
	A.resize(n + 1);
	A[0] = W;
	for (int i = 1; i <= n; i++) {
		cin >> A[i];
	}
	memset(dp, -1,  sizeof(dp));
	cout << func(1, 0, 0);
}


Measured memory_bytes: 31744
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "x", long, "y");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    long n, k;
    scan(n, k);
    auto h = aryread();
    h.sort();
    long kill;
    foreach (i; iota(min(k, n)))
    {
        kill += h[$ - 1 - i];
    }
    writeln(h.sum - kill);
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }

long long modpow(long long x, long long n, long long mod = 1000000007) {
  if (n < 0) return 0;
  long long ret = 1;
  while (n > 0) {
    if (n & 1) ret = ret * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return ret;
}

int main() {
  string s; cin>>s;
  int n = s.size();

  vector<long long> a(n), c(n), l(n), r(n);
  for (int i = 0, cnt = 0; i < n; ++i) {
    a[i] = cnt;
    if (s[i] == 'A') ++cnt;
  }
  for (int i = 0, cnt = 0; i < n; ++i) {
    l[i] = cnt;
    if (s[i] == '?') ++cnt;
  }
  for (int i = n-1, cnt = 0; i >= 0; --i) {
    c[i] = cnt;
    if (s[i] == 'C') ++cnt;
  }
  for (int i = n-1, cnt = 0; i >= 0; --i) {
    r[i] = cnt;
    if (s[i] == '?') ++cnt;
  }

  long long ans = 0;
  rep(i, n) if (s[i] == 'B' or s[i] == '?') {
    ans = (ans + a[i]*c[i]*modpow(3, l[i]+r[i])) % MOD;
    ans = (ans + l[i]*c[i]*modpow(3, l[i]+r[i]-1)) % MOD;
    ans = (ans + a[i]*r[i]*modpow(3, l[i]+r[i]-1)) % MOD;
    ans = (ans + l[i]*r[i]*modpow(3, l[i]+r[i]-2)) % MOD;
  }
  print(ans);

  return 0;
}

Measured memory_bytes: 3584
from itertools import permutations
n, m = map(int, input().split())

ab=[[] for _ in range(n)]#１から順にどの頂点からどの頂点に辺が続いているか
for i in range(m):
    a,b=map(int,input().split())
    ab[a-1].append(b-1)
    ab[b-1].append(a-1)

#print(ab)

l=list(range(1,n))
p = list(permutations(l, n - 1))#頂点をたどる順番。Nの階乗

ans=0
for i in p:
#    print(p)
    flg=0
    if i[0] not in ab[0]:
        continue   
    for j in range(n-2):
        if i[j+1] in ab[i[j]]:
            continue
        else:
            flg=1
            break
    if flg==0:
        ans+=1
print(ans)

Measured memory_bytes: 3572
def main():
    import sys
    input = sys.stdin.readline

    N, K, C = map(int, input().split())
    S = input().rstrip('\n')

    cnt = 0
    c = 0
    rec = {}
    prev = 0
    for i, s in enumerate(S):
        if c:
            c -= 1
            if s == 'o':
                rec[prev].append(i)
            continue
        if s == 'o':
            c = C
            rec[i] = []
            prev = i
            cnt += 1
    if cnt > K:
        exit()
    X = list(rec.keys())
    X.sort()
    ans = []
    prev = 10**9
    for i in range(K-1, -1, -1):
        x = X[i]
        prev_new = x
        for y in rec[x]:
            if y+C < prev:
                prev_new = y
            else:
                break
        if prev_new == x:
            ans.append(x+1)
        prev = prev_new
    for a in reversed(ans):
        print(a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 82376
#define _USE_MATH_DEFINES    
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define quickIO()   {cin.tie(0);    cout.sync_with_stdio(false);}
#define rep(i,n)    for(ll i=0; i<(ll)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define fcout cout << fixed << setprecision(10) 
const ll inf = 1e18;
const ll mod = 1e9 +7;
     
ld sqrtld(ld x){
    ld left = 0, right = x;
    rep(i, 100){
        ld mid = (left + right)/2;
        if (mid*mid <= x)   left =mid;
        else    right = mid;
    }
    return left;
}

ll gcd(ll a, ll b){
    if(b>a){
        ll c =b; b=a;   a=c;
    }
    ll d = a%b;
    if(d==0){
        return b;
    }else if(d==1){
        return 1;
    }else{
        gcd(b,d);
    }
}


ll cul(ll n){
    return (n-1)*n/2;
}


int main (){
    int n; cin >> n;
    priority_queue<ll> a;
    rep(i,n){
        ll b;   cin >> b ;
        a.push(b);
    }
    ll ans=0;
    int x=1;
    while(!a.empty()){
        if(x%2==1){
            ans += a.top();
            a.pop();
        }else{
            ans -= a.top();
            a.pop();
        }
        x++;
    }

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n, m;
    char str[10];
    int x;
    int i, j;
    

    
    scanf("%d %d", &m, &n);
    while (n != 0 && m != 0) {
        int p = 1, q = m;
        int players[1005] = {};
        int print[1005];
        int size = 0;
        
        for (i = 1; i <= n; i++) {
            scanf("%s", str);
            
            if ( q > 1) {
                if ( i % 3 == 0 && i % 5 == 0) {
                    if (strcmp(str, "FizzBuzz") != 0) {
                        players[p] = 1;
                    }
                } else if (i % 3 == 0 && i % 5 != 0) {
                    if (strcmp(str, "Fizz") != 0) {
                        players[p] = 1;
                    }
                } else if (i % 3 != 0 && i % 5 == 0) {
                    if (strcmp(str, "Buzz") != 0) {
                        players[p] = 1;
                    }
                } else {
                    x = 0;
                    for (j = 0; j < strlen(str); j++) {
                        x *= 10;
                        x += str[j] - '0';
                    }

                    if (x != i || 
                        strcmp(str, "Fizz") == 0 ||
                        strcmp(str, "Buzz") == 0 ||
                        strcmp(str, "FizzBuzz") == 0) {
                        players[p] = 1;
                    }
                }

                if (players[p] == 1) q--;
                do {
                    p++;
                    if (p > m) p = 1;
                } while(players[p] == 1);

            }

        }

        for (i = 1; i <= m; i++) {
            if (players[i] == 0) {
                print[size] = i;
                size++;
            }
        }

        for (i = 0; i < size; i++) {
            if (i) printf(" ");
            printf("%d", print[i]);
        }
        putchar('\n');

        scanf("%d %d", &m, &n);
    }

    return 0;
}



Measured memory_bytes: 2032
#include <algorithm>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

typedef pair<int, int> i_i;
struct edge { int v, w; };

int INF = INT_MAX / 2;

vector<int> wfs(int N, vector<vector<int> >& G, int s) {
	vector<int> d(N, INF); d[s] = 0;
	queue<int> q; q.push(s);
	while (q.size()) {
		int u = q.front(); q.pop();
		for (int v: G[u])
			if (d[v] > d[u] + 1) {
				d[v] = d[u] + 1;
				q.push(v);
			}
	}
	return d;
}

int main() {
	int N; cin >> N;
	vector<vector<int> > G(N);
	for (int i = 0; i < N; i++) {
		int u, k; cin >> u >> k;
		while (k--) {
			int v; cin >> v;
			G[u - 1].push_back(v - 1);
		}
	}
	vector<int> d = wfs(N, G, 0);
	for (int u = 0; u < N; u++) {
		if (d[u] == INF) d[u] = -1;
		cout << u + 1 << ' ' << d[u] << endl;
	}
}

Measured memory_bytes: 3152
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int W, H, x, y;
	int other;
	double size;

	cin >> W >> H >> x >> y;

	size = (double)W * H / 2;

	if (W % 2 == 0 && H % 2 == 0 && W / 2 == x && H / 2 == y) other = 1;
	else other = 0;

	printf("%.10lf %d\n", size, other);

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<queue>
#include<vector>
using namespace std;
const long long INF=200000000000000000LL;
typedef pair<int,int> P;
int main(){
	int N,A,ans=0,B=0;
	cin>>N;
	if(N/10==9||N%10==9){
		cout<<"Yes"<<endl;
	}else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


const int MAX_N = 1<<19;
int dat[2 * MAX_N -1];
int n;

struct SegmentTree{
    SegmentTree(int n_){
        n=1;
        while(n<n_) n*= 2;
        for(int i=0;i<2*n-1;i++){
            dat[i]=0;
        }
    }
    int query(int k){
        k += n-1;
        int count=dat[k];
        while(k>0){
            k=(k-1)/2;
            count+=dat[k];
        }
        return count;
    }
    void update(int a,int b,int k,int p,int l,int r){
        if(r<=a || b<=l) return;
        if(a<=l && r<=b){
            dat[k]+=p;
        }
        else{
            update(a,b,k*2+1,p,l,(l+r)/2);
            update(a,b,k*2+2,p,(l+r)/2,r);
        }
    }
};




void solve(){
    ll _n,d,a;
    ll x[200010],h[200010];
    cin>>_n>>d>>a;
    rep(i,_n) cin>>x[i]>>h[i];
    pll p[200010];
    rep(i,_n) p[i]={x[i],h[i]};
    sort(p,p+_n);
    vll v;
    ll ans=0;

    SegmentTree sg(_n);

    ll now=0;
    rep(i,_n){
        // cout<<p[i].fi<<" "<<p[i].sc<<endl;
        if(i!=0){
            if(lower_bound(v.begin(),v.end(),p[i].fi)!=v.end()){
                ll k=LB(v,p[i].fi);
                
                p[i].sc-=sg.query(k)*a;
                // cout<<i<<" p[i]:"<<p[i].fi<<" k:"<<k<<" "<<v[k]<<" "<<p[i].sc<<endl;
            }
        }
        if(p[i].sc<=0) continue;
        ll cnt=p[i].sc/a+(p[i].sc%a!=0);
        if(cnt<=0) continue;
        // cout<<i<<"cnt:"<<cnt<<endl;
        ans+=cnt;

        v.pb(p[i].fi+d*2);
        sg.update(0,now+1,0,cnt,0,n);
        now++;
    }
    cout<<ans<<endl;

    // rep(i,_n){
    //     cout<<i<<" "<<sg.query(i)<<endl;
    // }
    

}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    
     

    solve(); 


    return 0;
}


Measured memory_bytes: 15580
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		System.out.println((Math.abs(a - c) <= d) || ((Math.abs(a - b) <= d) && (Math.abs(b - c) <= d)) ? "Yes" : "No");
	}
}

Measured memory_bytes: 22996
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<cmath>
#include<cstdlib>

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

	long long x = 0, y = std::accumulate(a.begin(), a.end(), 0LL), min_val = std::pow(10, 9) * N;
	for (int i = 0; i < N - 1; i++) {
		x += a[i];
		y -= a[i];
		min_val = std::min(std::abs(x - y), min_val);
	}
	std::cout << min_val << std::endl;
}

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

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  for (int i = 0; i < n - 1; ++i) {
    if (x < a[i]) {
      cout << i << endl;
      return 0;
    }
    x -= a[i];
  }
  if (x == a[n - 1]) cout << n << endl;
  else cout << n - 1 << endl;
  return 0;
}

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

#define IOS cin.tie(0);ios_base::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vs      vector<string>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())
#define END cout<<"\n"

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)    for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?" ":"\n"); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//


signed main(){
    CIN(s,w);
    if(w>=s)printf("unsafe");
    else printf("safe");


    return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(int i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(int i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
#define vvv(T) v(v(v(T)))
typedef v(int) vi;
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  int N;
  cin >> N;
  vi A(N);
  cin >> A;
  sort(rng(A));

  if(A[0] == 1) {
    if(N > 1 and A[1] == 1) {
      cout << 0 << "\n";
    } else {
      cout << 1 << "\n";
    }
    return;
  }

  v(bool) elatos(A[N-1] + 1, true);

  int ans = 0;
  rep(i, N) {
    if(!elatos[A[i]]) continue;
    if((i == 0 or A[i-1] != A[i]) and (i + 1 == N or A[i] != A[i+1])){
      ans++;
    }
    for(int j = 2; A[i] * j <= A[N-1]; j++) {
      elatos[A[i] * j] = false;
    }
  }

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

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

Measured memory_bytes: 4204
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  int j=0,s=0;
  for(int i=1;i<n;i++){
    j+=i;
  }
  for(int i=1;i<m;i++){
    s+=i;
  }
  cout << j+s << endl;
  return 0;
}

Measured memory_bytes: 256
N=int(input())
List = list(map(int, input().split()))
res = 0
for i in range(N-2):
  if List[i] < List[i+1] and List[i+1] < List[i+2]:
    res += 1
  elif List[i] > List[i+1] and List[i+1] > List[i+2]:
    res += 1
print(res)

Measured memory_bytes: 9024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	F := make([][]int, N)
	for i := 0; i < N; i++ {
		F[i] = sc.nextIntSlice(10)
	}
	P := make([][]int, N)
	for i := 0; i < N; i++ {
		P[i] = sc.nextIntSlice(11)
	}
	ans := int(-1e+10)
	for bit := 0; bit < 1<<uint(10); bit++ {
		arr := make([]bool, 10)
		for i := 0; i < 10; i++ {
			if 1<<uint(i)&bit > 0 {
				arr[i] = true
			}
		}
		ok := false
		for _, b := range arr {
			if b {
				ok = true
			}
		}
		if !ok {
			continue
		}
		total := 0
		for store, sales := range F {
			count := 0
			for i, sale := range sales {
				if sale == 1 && arr[i] {
					count++
				}
			}
			total += P[store][count]
		}
		if ans < total {
			ans = total
		}
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>


int main() {
    const double pi = acos(-1);
    double a, b, c;
    scanf("%lf %lf %lf", &a, &b, &c);
    printf("%.4lf\n", a * b * sin(c * pi / 180) / 2);
    printf("%.4lf\n", a + b + sqrt(a * a + b * b - 2 * a * b * cos(c * pi / 180)));
    printf("%.4lf\n", b * sin(c * pi / 180));
}


Measured memory_bytes: 2116
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include <map>
using namespace std;
const int maxn = 100007;
map<int,int> Q;
int n,t,m;
int main()
{
	cin>>n;
	int sum = 0;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		if(!Q.count(x))
		{
			sum++;
			Q[x]=1;
		}
	}
	cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 256