akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()


int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<int> ctr(26, 0);
    rep (i, s.size()) {
        ctr[s[i] - 'a']++;
    }
    ll mod = 1e9 + 7;
    ll ans = 1;
    rep (i, 26) {
        ans *= ctr[i] + 1;
        ans %= mod;
    }
    cout << (ans - 1) % mod << endl;

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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 (a > b) {
    a = b;
    return true;
  }
  return false;
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int r; cin >> r;
  cout << 3*r*r << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
int main(){
  string s,t; cin >> s >> t;
  map<char,char> m;
  map<char,char> ttos;
  for(char c='a';c<='z';c++){
    m[c]=' ';
    ttos[c]=' ';
  }
  
  rep(i, s.size()){
    if((m[s[i]]==' '&&ttos[t[i]]==' ')||(m[s[i]]==t[i]&&ttos[t[i]]==s[i])){
      m[s[i]]=t[i];
      ttos[t[i]]=s[i];
      continue;
    }
    cout << no;
    return 0;

  }
  cout << yes;
  return 0;
}


Measured memory_bytes: 776
#include<iostream>
#include<vector>
using namespace std;
int main(){
    vector<int> taro,hanako;
    int taron,hanakon;
    int n;
    bool *tarohave;
    while(cin>>n&&n!=0){
        tarohave=new bool[n*2+1]{false};
        int dummy;
        for(int i=0;i<n;++i){
            cin>>dummy;
            tarohave[dummy]=true;
        }
        for(int i=1;i<=n*2;++i){
            if(tarohave[i]==false){
                hanako.push_back(i);
            }else{
                taro.push_back(i);
            }
        }
        int desk=0;
        taro.push_back(201);
        hanako.push_back(201);
        vector<int>::iterator place;
        taron=n;
        hanakon=n;
        bool dotti=true;
        while(taron!=0&&hanakon!=0){
            if(dotti){
                for(place=taro.begin();*place<desk;++place);
                if(*place==201){
                    desk=0;
                }else{
                    desk=*place;
                    *place=-1;
                    --taron;
                }
            }else{
                for(place=hanako.begin();*place<desk;++place);
                if(*place==201){
                    desk=0;
                }else{
                    desk=*place;
                    *place=-1;
                    --hanakon;
                }
            }
            dotti=!dotti;
            hanako.clear();
            taro.clear();
        }
        delete[] tarohave;
        cout<<hanakon<<endl<<taron<<endl;
    }
    return 0;
}

Measured memory_bytes: 3156
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;



int main(){
    int N;
    cin >> N;
    
    int x;
    vector<int> a;
    for(int i = 0; i < N ; ++i){
        cin >> x;
        a.push_back(x);
    }
    
    sort(a.begin(), a.end());
    
    int num = 0;
    
    int cnt = 0;
    
    for(int i = 0; i < N; ++i){
        if(num == a[i]){
            
        } else {
            ++cnt;
            num = a[i];
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
n = int(input())
ls = list(map(int, input().split()))
ans = 0
san = []

for i in range(len(ls)):
    for j in range(i+1, len(ls)):
        for k in range(j+1, len(ls)):
            temp1 = ls[i] != ls[j] and ls[j] != ls[k] and ls[i] != ls[k]
            temp2 = ls[i] + ls[j] > ls[k] > abs(ls[i]-ls[j])
            temp3 = ls[j] + ls[k] > ls[i] > abs(ls[j]-ls[k])
            temp4 = ls[i] + ls[k] > ls[j] > abs(ls[i]-ls[k])
            if temp1 and (temp2 or temp3 or temp4):
                san.append([ls[i], ls[j], ls[k]])

                ans += 1

print(ans)


Measured memory_bytes: 25300
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException e){
			e.printStackTrace();
		}
	}
	
	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		List<String> Ans = new ArrayList<String>();
		String line;
		
		while((line = in.readLine()) != null){
			int size = Integer.parseInt(line);
			if(size == 0) break;
			food[] lunch = new food[size];
			for(int i=0; i<size; i++){
				line = in.readLine();
				String[] dst = line.split(" ");
				int w = Integer.parseInt(dst[1]);
				int s = Integer.parseInt(dst[2]);
				lunch[i] = new food(dst[0], w, s);
			}
			LunchSort(lunch);
			
			for(int i=0; i<size; i++){
				Ans.add(lunch[i].name);
			}
		}
		
		for(int i=0; i<Ans.size(); i++){
			System.out.println(Ans.get(i));
		}
	}
	
	public void LunchSort(food[] lunch){
		int size = lunch.length;
		List<food> foods = new ArrayList<food>();
		int sum = 0;
		for(int i=0; i<size; i++){
			foods.add(lunch[i]);
			sum += lunch[i].w;
		}
		
		while(foods.size() != 0){
			int max_w = 0;
			int index = -1;
			for(int i=0; i<foods.size(); i++){
				if(sum-foods.get(i).w <= foods.get(i).s && max_w < foods.get(i).w){
					max_w = foods.get(i).w;
					index = i;
				}
			}
			
			lunch[size - foods.size()] = foods.get(index);
			sum -= foods.get(index).w;
			foods.remove(index);
		}		
	}
}

class food{
	String name;
	int w;
	int s;
	
	public food(String name, int w, int s){
		this.name = name;
		this.w = w;
		this.s = s;
	}
}

Measured memory_bytes: 9728
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int n, h[100002], cnt, ans;

int main(){
	
	cin >> n;
	rep(i, n)cin >> h[i];

	rep(i, n - 1){
		if (h[i] >= h[i + 1])cnt++;
		else {
			ans = max(cnt, ans);
			cnt = 0;
		}
	}
	ans = max(cnt, ans);

	cout << ans << endl;

	return 0;
}


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

typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int ans = INF;
    for(int i = 0;i < s.size()-2;i++){
        ans = min(ans,abs(stoi(s.substr(i,3))-753));
    }
    cout << ans << endl;
}


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

using namespace std;

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

    int i;

    int a[n];

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

    sort(a, a + n);

    int ans = 0;

    for (i = 0; i < k; i++)
    {
        ans += a[i];
    }

    cout << ans;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define sync ios::sync_with_stdio(false); cin.tie(NULL); cerr.tie(NULL);

int main(){
  sync;
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a,a+3);
  cout << a[2]-a[0] << endl;
  return 0;
}


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

int main(){
    ll n,m;
    cin >> n >> m;
    vector<P> ab(n);
    rp(i,n){
        ll a,b;
        cin >> a >> b;
        ab.at(i)=make_pair(a,b);
    }
    sort(ab.begin(),ab.end());
    int ctr=0;
    ll money=0ll;
    while(m>0){
        if(m<ab.at(ctr).second){
            money += ab.at(ctr).first*m;
            m=0;
        }
        else{
            money += ab.at(ctr).first*ab.at(ctr).second;
            m-=ab.at(ctr).second;
            ctr++;
        }
    }
    cout << money << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long K, G_X, G_Y;
  cin >> K >> G_X >> G_Y;

  vector<pair<long, long>> ans;

  if (K % 2 == 0 and (abs(G_X) + abs(G_Y)) % 2 == 1) {
    cout << -1 << endl;
    return;
  }

  long x = 0;
  long y = 0;

  while (abs(G_X - x) + abs(G_Y - y) > 2 * K) {
    long dir_x = (G_X - x < 0) ? -1 : 1;
    long dir_y = (G_Y - y < 0) ? -1 : 1;
    long rest = K;
    long dis_x = min(abs(G_X - x), rest);
    rest -= dis_x;
    long dis_y = rest;
    rest -= dis_y;
    x += dis_x * dir_x;
    y += dis_y * dir_y;
    ans.push_back(make_pair(x, y));
    // cout << x << " " << y << endl;
  }

  // if ((G_X + G_Y) % 2 != (x + y) % 2) {
  if ((abs(G_X - x) + abs(G_Y - y)) % 2 != 0) {
    long dir_x = (G_X - x < 0) ? -1 : 1;
    long dir_y = (G_Y - y < 0) ? -1 : 1;
    long rest = K;
    long dis_x = min(abs(G_X - x), rest);
    rest -= dis_x;
    long dis_y = rest;
    rest -= dis_y;
    x += dis_x * dir_x;
    y += dis_y * dir_y;
    ans.push_back(make_pair(x, y));
  }

  {
    long dist = abs(G_X - x) + abs(G_Y - y);
    long asdf = ((dist + 1) % 2);
    long xxx = 100 / asdf;
    cerr << xxx << endl;
    if (dist == 0) {
    }
    else if (dist == K) {
      x = G_X;
      y = G_Y;
      ans.push_back(make_pair(x, y));
      // cout << G_X << " " << G_Y << endl;
    }
    else if (abs(G_X - x) > abs(G_Y - y)) {
      long dir_x = (G_X - x < 0) ? -1 : 1;
      long dir_y = (G_Y - y < 0) ? -1 : 1;
      long foo = dist / 2;
      x += foo * dir_x;
      y -= (K - foo) * dir_y;
      ans.push_back(make_pair(x, y));
      // cout << x << " " << y << endl;
      x = G_X;
      y = G_Y;
      ans.push_back(make_pair(x, y));
      // cout << G_X << " " << G_Y << endl;
    } else {
      long dir_x = (G_X - x < 0) ? -1 : 1;
      long dir_y = (G_Y - y < 0) ? -1 : 1;
      long foo = dist / 2;
      x -= (K - foo) * dir_x;
      y += foo * dir_y;
      ans.push_back(make_pair(x, y));
      // cout << x << " " << y << endl;
      x = G_X;
      y = G_Y;
      ans.push_back(make_pair(x, y));
      // cout << G_X << " " << G_Y << endl;
    }
  }

  cout << ans.size() << endl;
  for (auto it: ans) cout << it.first << " " << it.second << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 5484
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 0; i < n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<
#define AA(i) cout<<i<<endl;
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
    char N; cin >> N;
    int K = N;
    if(K>95) {AA('a');}
    else AA('A');
    return 0;
}

Measured memory_bytes: 3628
N,M,X=[int(i) for i in input().split()]
A = [int(i) for i in input().split()]
a = 0
b = 0
for i in range(1,X):
    if i in A:
        a += 1
for i in range(X+1,N):
    if i in A:
        b += 1

print(min(a,b))

Measured memory_bytes: 3064
# coding: utf-8
MOD = 1_000_000_007
 
class Combination
  def initialize
    @fact = (1..10**5+1).to_a
    @fact.each_with_index do |e, idx|
      @fact[idx] = @fact[idx] * @fact[idx-1] % MOD if idx > 0
    end
  end
 
  def choose(n, r)
    return 0 if not (0 <= r and r <= n)
    return 1 if r == 0 or r == n
    fact(n) * inverse( fact(r) * fact(n-r) )
  end
 
  def fact(n)
    @fact[n-1]
  end
 
  def inverse(x)
    pow(x, MOD-2)
  end
 
  def pow(x, n)
    ans = 1
    while n > 0
      ans = ans * x % MOD if n.odd?
      x = x * x % MOD
      n >>= 1
    end
    ans
  end
end

lines = $stdin.read
array = lines.split("\n")
 
$n = array[0].to_i
$a = array[1].split(" ").map(&:to_i)
 
@comb = Combination.new

dup=$a.sort.each_cons(2).select{|a,b|a==b}.flatten[0]
l,r=$a.index(dup),$a.rindex(dup)
(1..($n+1)).each do |k|
  puts (@comb.choose($n+1,k)-@comb.choose($n+1-(r-l+1),k-1)) % MOD
end


Measured memory_bytes: 13800
#include<bits/stdc++.h>
using namespace std;
const int N=4e5+5;
int n,num,ans[N],rt[N],t[N*50],ls[N*50],rs[N*50],tot,a[N],hs[N],head[N],nex[N<<1],to[N<<1];
void add(int u,int v){to[++tot]=v;nex[tot]=head[u];head[u]=tot;}
int newnode(){return ++num;}
void Insert(int l,int r,int x,int v,int &now,int pre)
{
    if(!now) now=newnode(),t[now]=t[pre];
    t[now]=max(t[now],v);
    if(l==r) return;
    int m=l+r>>1;
    if(x<=m) Insert(l,m,x,v,ls[now],ls[pre]),rs[now]=rs[pre];
    else Insert(m+1,r,x,v,rs[now],rs[pre]),ls[now]=ls[pre];
}
int query(int l,int r,int x,int now)
{
    if(!now||l>x) return 0;
    if(r<=x) return t[now];
    int m=l+r>>1;
    return max(query(l,m,x,ls[now]),query(m+1,r,x,rs[now]));
}
void dfs(int u,int p)
{
    ans[u]=query(1,n,a[u]-1,rt[p])+1;
    Insert(1,n,a[u],ans[u],rt[u],rt[p]);
    ans[u]=max(ans[u],ans[p]);
    for(int i=head[u];i;i=nex[i])
    {
        int v=to[i];if(v==p) continue;
        dfs(v,u);
    }
}
void build(int l,int r,int &now)
{
    now=newnode();
    if(l==r) return;
    int m=l+r>>1;
    build(l,m,ls[now]);build(m+1,r,rs[now]);
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]),hs[i]=a[i];
    sort(hs+1,hs+1+n);
    for(int i=1;i<=n;i++) a[i]=lower_bound(hs+1,hs+1+n,a[i])-hs;
    build(1,n,rt[0]);
    for(int i=1;i<n;i++)
    {
        int u,v;scanf("%d%d",&u,&v);add(u,v);add(v,u);
    }
    dfs(1,0);
    for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
}


Measured memory_bytes: 66120
import java.util.ArrayList;
import java.util.TreeMap;
import java.util.List;
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    TreeMap<String,Integer> map = new TreeMap<>();
    for(int i = 0; i < n; i++){
      String key = sc.next();
      if(map.get(key) == null){
        map.put(key,0);
      }else{
          map.put(key, map.get(key) + 1);
      }
    }
    List<String> keylist = new ArrayList<>(map.keySet());
    List<String> output = new ArrayList<>();
    int max = 0;
    for(int i = 0; i < keylist.size(); i++){
      if(map.get(keylist.get(i)) > max){
        output.clear();
        output.add(keylist.get(i));
        max = map.get(keylist.get(i));
      }else if(map.get(keylist.get(i)) == max){
        output.add(keylist.get(i));
        max = map.get(keylist.get(i));
      }
    }
    for(int i = 0; i < output.size(); i++){
      System.out.println(output.get(i));
    }
  }
}

Measured memory_bytes: 87792
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
signed main()
{
	string s;
	cin>>s;
	int cnt=0;
	for (int i=0;i<sz(s);i++){
		cnt+=s[i]-'0';
	}
	if (cnt%9)  cout<<"No";
	else  cout<<"Yes";
	re 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
vector<vector<int64>> G;
vector<string> v;

void dfs(int64 u = 0, int64 level = -1) {
  if (u != 0) {
    REP(i, level) cout << ".";
    cout << v[u] << endl;
  }
  REP(i, G[u].size()) {
    dfs(G[u][i], level+1);
  }
}

int main(void) {
  int64 n;
  cin >> n;
  G.resize(n+1);
  v.resize(n+1);
  REP(i, n) {
    int64 k; string s;
    cin >> k >> s;
    G[k].push_back(i+1);
    v[i+1] = s;
  }
  dfs(0);
}


Measured memory_bytes: 3360
#include<iostream>
using namespace std;
//atcoder contest
int main()
{
   int a,b,c,count=1;
   string s;
   cin>>s;

   for(a=0;a<3;a++)
   {
     if(s[a]=='R' && s[a+1]=='R')
     {
        count++;
     }
   }
   if(s[0]=='R' && s[1]=='S' && s[2]=='R')
   {
      cout<<1<<endl;
      return 0;
   }
   else if(s[0]=='S' && s[1]=='S' && s[2] == 'S')
   {
      cout<<0<<endl;
   }
   else
     cout<<count<<endl;
}


Measured memory_bytes: 3164
def main():
    n=int(input())  #数値入力
    a=list(map(int, input().split()))  #リスト入力（数値)
    num = a[0]

    for i in range(n-1):
        num = gcd(num, a[i+1])
    print(num)

# 最大公約数
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

main()

Measured memory_bytes: 14224
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        public static void Main()
        {
            string S = Console.ReadLine();
            int N = S.Length;
            string[] s = new string[N];
            string ans = "Yes";

            //文字列
            for (int i = 0; i < N; i++)
            {
                s[i] = S.Substring(i, 1);
            }

            //回文かどうかの判断
            for (int i = 0; i < N / 2; i++)
            {
                if (s[i] != s[N - 1 - i])
                {
                    ans = "No";
                    i = 100;
                }
            }
            //特定が回文かどうかの判定
            if (ans == "Yes")
            {
                for (int i = 0; i < N / 4; i++)
                {
                    if (s[i] != s[(N - 1) / 2 - 1 - i])
                    {
                        ans = "No";
                        i = 100;
                    }
                }
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
//43
#include<iostream>

using namespace std;

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

void ff(int x,int y){
  if(g[y][x]!=0)return;
  g[y][x]=2;
  for(int i=0;i<6;i++){
    int nx=x+dx[y%2][i];
    int ny=y+dy[i];
    if(0<=nx&&nx<102&&0<=ny&&ny<102){
      ff(nx,ny);
    }
  }
}

int main(){
  int w,h;
  cin>>w>>h;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      cin>>g[i][j];
    }
  }
  ff(0,0);
  int a=0;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      for(int k=0;k<6;k++){
	int nx=j+dx[i%2][k];
	int ny=i+dy[k];
	a+=g[i][j]!=2&&g[ny][nx]==2;
      }
    }
  }
  cout<<a<<endl;
  return 0;
}

Measured memory_bytes: 1676
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,K;
    cin >> N >> K;
    int a[N];
    bool dp[K+1];
    dp[0]=0;
    for(int i=0; i<N; i++){
        cin >> a[i];
    }
    for(int i=1; i<=K; i++){
        dp[i]=0;
        for(int j=0; j<N; j++){
            if(a[j]<=i && !dp[i-a[j]]){
                dp[i] = 1;
            }
        }
    }
    cout << (dp[K]?"First":"Second") << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"
#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"

ll min(ll x,ll y){return (x<y ? x:y);}
ll max(ll x,ll y){return (x>y ? x:y);}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}

ll a[1001];
ll b[1001];
ll c[1001];
vector<ll> v;

int main(){
  ll X,Y,Z,K; cin>>X>>Y>>Z>>K;
  CINA(a,X);
  CINA(b,Y);
  CINA(c,Z);
  sort(a,a+X,greater<ll>());
  sort(b,b+Y,greater<ll>());
  sort(c,c+Z,greater<ll>());
  
  REP(i,X){
    REP(j,Y){
      REP(k,Z){
        if((i+1)*(j+1)*(k+1)<=K){v.push_back(a[i]+b[j]+c[k]);}
        else break;
      }
    }
  }
  sort(ALL(v),greater<ll>());
  REP(i,K){
    printf("%Ld\n",v.at(i));
  }
}

Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (s.charAt(s.length() - 1) == 's') {
            System.out.println(s + "es");
        } else {
            System.out.println(s + "s");
        }

    }
}

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

int main()
{
    int a[4], b[4];

    int sum1 = 0, sum2 = 0;
    for( int i = 0; i < 4; i++ )
    {
        cin >> a[i];
        sum1 += a[i];
    }
    
    for( int i = 0; i < 4; i++ )
    {
        cin >> b[i];
        sum2 += b[i];
    }

    if( sum1 > sum2 )
        cout << sum1 << endl;
    else
        cout << sum2 << endl;

    return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s;
    cin>>s;
    int p=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='p'){
            p++;
        }
    }
    int n=s.length();
    n>>=1;
    //cout<<n<<endl;
    cout<<n-p<<endl;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
const long N_MAX = 100000+10;

long long a[N_MAX];
long long sat[N_MAX];
long n;

bool isSaturate(int a){
  return sat[a] == a;
}

int main()
{
  for(long long i=0;i<N_MAX;i++) sat[i]=0;

  cin >> n;
  long long count = 0; 
  for(long long i=0;i<n;i++) cin >> a[i];
  
  for(long long i=0;i<n;i++){
    if(a[i] > N_MAX){
      count++;
    }else{
      if(isSaturate(a[i])){
	count++;
      }else{
	sat[a[i]]++;
      }
    }
  }

  for(long long i=0;i<N_MAX;i++){
    if(!isSaturate(i)){
      count += sat[i];
    }
  }

  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] uarr = new int[n];
		int[] darr = new int[n];
		for (int i = 0; i < n; i++) {
			uarr[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			darr[i] = sc.nextInt();
		}
		int max = 0;
		for (int i = 0; i < n; i++) {
			int count = 0;
			for (int j = 0; j < n; j++) {
				if (j <= i) {
					count += uarr[j];
				}
				if (j >= i) {
					count += darr[j];
				}
			}
			if (count > max) {
				max = count;
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 23892
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cctype>
#include <stack>
#include <map>
#include <cstring>
#include <sstream>
#include <set>
#include <list>
#include <fstream>
#include <iomanip>
#include <assert.h>

#define ll long long
#define ull unsigned long long
#define pii std::pair<int, int>
#define op                            \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);

const int INF = 0x3f3f3f3f;
const int maxn = (100000 + 10);
const int mod = (1e9 + 7);

int main()
{
    int n, ans=0;;
    std::string s;
    std::cin>>n>>s;
    for(int i=0;i<n-2;i++)
    {
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
            ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int k,i,e=10;
long long r[100001];
int main(){
    scanf("%d",&k);
    for(i=1;i<10;i++)r[i]=i;
    for(i=1;i<k;i++){
        if(e>100000)continue;
        if(r[i]%10!=0){
            r[e]=10*r[i]+r[i]%10-1;
            e++;
        }
        r[e]=10*r[i]+r[i]%10;
        e++;
        if(r[i]%10!=9){
            r[e]=10*r[i]+r[i]%10+1;
            e++;
        }
    }
    printf("%lld",r[i]);
    return 0;
}

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

double dp[3001][3][3001];
double p[3000];

void solve()
{
  int n; cin >> n;
  dp[0][0][0] = 1.0;
  dp[0][1][0] = 1.0;
  for (int i = 1; i <= n; i++)
  {
    cin >> p[i];
  }
  
  dp[1][1][1] = p[1];
  dp[1][2][0] = 1.0 - p[1];
  
  for (int i = 2; i <= n; i++)
  {
    for (int j = 0; j <= i; j++)
    {
      dp[i][2][j] += dp[i - 1][2][j] * (1 - p[i]);
      dp[i][2][j] += dp[i - 1][1][j] * (1 - p[i]);
      dp[i][1][j + 1] += dp[i - 1][1][j] * p[i];
      dp[i][1][j + 1] += dp[i - 1][2][j] * p[i];
    }
  }
  
  double ans = 0.0;
  for (int i = n / 2 + 1; i <= n; i++)
  {
    ans += dp[n][1][i];
    ans += dp[n][2][i];
  }
  
  cout << fixed << setprecision(12) << ans << endl;
}

int main()
{
  solve();
  return 0;
}

Measured memory_bytes: 209536
n,m = gets.chomp.split(" ").map(&:to_i)
ary1 =  gets.chomp.split(" ").map(&:to_i)
total = ary1.inject(&:+)
sikii = total/(4.0*m)
kosuu = ary1.select{|elem| elem >= sikii}.length
if kosuu >=m
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define ll128 __uint128_t
#define ld long double
#define pll pair <ll, ll>

#define vll vector <ll>
#define vld vector<ld>
#define vpll vector<pll>

#define vvll vector <vll>

#define rep(i, a, b) for(ll i = a; i < b; i++)
#define per(i, a, b) for(ll i = (ll)a - 1; i >= b; --i)

#define endl "\n"
#define pb push_back
#define pf push_front

#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

#define sorta(v) sort(all(v))
#define sortd(v) sort(rall(v))

#define debug if (1)
#define log(val) debug {cout << "\n" << #val << ": " << val << "\n";}

#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define file(name) freopen(name".in", "r", stdin); freopen(name".out", "w", stdout);
#define FILE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

#define mod (ll)(1e9 + 7)
#define inf (mod * mod)

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

ostream & operator << (ostream & out, vll & a) {
    for(auto i : a) out << i << " ";
    return out;
}

istream & operator >> (istream & in, vll & a) {
    for(auto &i : a) in >> i;
    return in;
}

const ll N = 52;
ll dp[2][N * N * 2];

int main() {
    ll n, av;
    cin >> n >> av;
    vll a(n);
    cin >> a;

    for (auto & i : a) {
        i -= av;
    }
    dp[1][N * N] = 1;
    rep(i, 1, n + 1) {
        rep(w, -N * N, N * N) dp[0][w + N * N] = dp[1][w + N * N];
        rep(w, -N * N, N * N) {
            dp[1][w + a[i - 1] + N * N] += dp[0][w + N * N];
        }
    }
    cout << dp[1][N * N] - 1 << endl;

    return 0;
}


Measured memory_bytes: 3724
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<int, int>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  vector<int> tmp(N);
  rep(i, N) cin >> tmp[i];
  vector<P> h(N);
  rep(i, N){
    h[i].first = tmp[i];
    h[i].second = tmp[i] - 1;
  }
  vector<int> q;
  q.push_back(min(h[0].first, h[0].second));
  for (int i = 1; i < N; ++i){
    if (min(h[i].first, h[i].second) >= q[i - 1]) q.push_back(min(h[i].first, h[i].second));
    else q.push_back(max(h[i].first, h[i].second));
  }
  bool flag = true;
  rep(i, N - 1){
    if (q[i] > q[i + 1]) flag = false;
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

class UnionFind{
public:
    //親の番号を格納する。親だった場合はー（その集合のサイズ）
    vector<int> parents;

    //作る時はparentsを-1で初期化する
    //こうすることで全部ばらばらになる
    UnionFind(int n){
        parents = vector<int>(n, -1);
    }

    //Aがどのグループにいるか調べる
    int root(int A){
        if(parents[A]<0) return A;
        return parents[A] = root(parents[A]);
    }

    //自分のいるグループの大きさを調べる
    int size(int A){
        return -parents[root(A)];
    }

    //AとBをくっつける
    bool connect(int A, int B){
        //AとBを直接ではなく親同士をくっつける
        A=root(A);
        B=root(B);
        if(A==B){
            return false;
        }

        //大きい方（A)に小さい方（B)をくっつけたい
        if(size(A)<size(B)) swap(A, B);

        parents[A] += parents[B];
        parents[B] = A;

        return true;
    }
};


int main(){
    int N, M; cin >> N >> M;
    UnionFind uni(N);

    for(int i=0; i<M; i++){
        int x,y,z; cin >> x >> y >> z;
        x--; y--;
        uni.connect(x, y);
    }

    map<int, int> mp;
    for(int i=0; i<N; i++) mp[uni.root(i)]++;
    cout << mp.size() << endl;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N; cin >> N;
    vector<int> G[N];
    vector<pair<int, int>> vp;
    map<pair<int, int>, int> I;
    for (int i = 1; i < N; i++)
    {
        int a, b; cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
        vp.push_back(make_pair(a, b));
    }

    vector<int> seen(N, 0);
    vector<int> cs(N, 0);
    queue<int> que;
    int K = 0;
    seen[0] = 1;
    que.push(0);
    while (!que.empty())
    {
        int v = que.front(); que.pop();
        if(K < (int)G[v].size()) K = G[v].size();
        int cur = 1;
        for (auto next_v : G[v])
        {
            if(seen[next_v]) continue;
            if(cur == cs[v]) cur++;
            seen[next_v] = 1;
            cs[next_v] = I[make_pair(v, next_v)] = I[make_pair(next_v, v)] = cur++;
            que.push(next_v);
        }
    }

    cout << K << endl;
    for (auto p : vp)
    {
        cout << I[p] << endl;
    }

    return 0;
}

Measured memory_bytes: 20084
//you**can**do**anything 
#include <bits/stdc++.h> 
#define ll long long
#define read(i) scanf("%lli" , &i)
const ll maxn=1e6;
using namespace std; 

int main() 
{ 


ll a , b ,k ;
cin>>a>>b>>k ;
vector<ll> A(a+1 , 0) ,B(b+1, 0);

for(ll i =1 ;i<=a ;i++)
{
	cin>>A[i];
	A[i]+=A[i-1];
}  
for(ll i =1 ;i<=b ;i++)
{
	cin>>B[i];
	B[i]+=B[i-1];
}

ll i=0 ,ans = 0 ;
while(i<=a)
{
	if(A[i]>k)
	break;
	
	ll j = lower_bound(B.begin() ,B.end() , k-A[i]) - B.begin() ;
	

	 if(j>b or B[j] > k -A[i] )
	 j--;
	 //	cout<<"j = "<< j<<"B[j] = "<<B[j]<<"i = "<< i<<" A[i] = "<<A[i]<<"\n";
	 ans= max(ans  , i+j );
	 i++;
}
cout<<ans<<"\n";

 return 0;
 
}

Measured memory_bytes: 6428
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long con =0;

		long[] monsters = new long[N];

		for (int i = 0; i < N; i++) {
			monsters[i] += sc.nextLong();
		}

		Arrays.sort(monsters);

		for (int i = 0; i < N - K; i++) {
			con += monsters[i];
		}

		System.out.println(con);

	}
}

Measured memory_bytes: 61108
import java.lang.Math

fun main(args: Array<String>)
{
    val (n) = readInts()
    val b = readIntArr()

    var sum = b[0] + b[n-2]

    for (i in 0..n-3) {
        sum += if (b[i] < b[i+1]) b[i] else b[i+1]
    }

    println(sum)
}

fun readInts(): List<Int> = readLine()!!.split(" ").map(String::toInt)
fun readLongs(): List<Long> = readLine()!!.split(" ").map(String::toLong)

fun readIntArr(): IntArray = readLine()!!.split(" ").map(String::toInt).toIntArray()
fun readLongArr(): LongArray = readLine()!!.split(" ").map(String::toLong).toLongArray()

fun readIntArrS(): IntArray = readLine()!!.split(" ").map(String::toInt).toIntArray().sortedArray()
fun readLongArrS(): LongArray = readLine()!!.split(" ").map(String::toLong).toLongArray().sortedArray()

fun readIntArrSD(): IntArray = readLine()!!.split(" ").map(String::toInt).toIntArray().sortedArrayDescending()
fun readLongArrSD(): LongArray = readLine()!!.split(" ").map(String::toLong).toLongArray().sortedArrayDescending()

fun readString() = readLine()!!


Measured memory_bytes: 37908
#include<stdio.h>
#define ll long long
int main()
{
	int n;
	ll int a,b,x;
	int count=0;
	scanf("%d %lld %lld",&n,&a,&b);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&x);
		if(x<a || x>=b)
		count++;
	}
	printf("%d\n",count);
}

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

#define INF 1e9
using namespace std;

int main() {

    char b; cin >> b;

    if (b == 'A') {
        cout << 'T' << endl;
        return 0;
    }

    if (b == 'T') {
        cout << 'A' << endl;
        return 0;
    }

    if (b == 'C') {
        cout << 'G' << endl;
        return 0;
    }

    if (b == 'G') {
        cout << 'C' << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;
int read(){
	int x=0,f=1; char ch=getchar();
	while (ch<'0' || ch>'9') {if (ch=='-') f=-1; ch=getchar();}
	while (ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
char s[100010];
int a[100010];
int main(){
	scanf("%s",s+1);
	int len=strlen(s+1);
	for (int i=1; i<=len; i++) a[i]=s[i]-'0';
	int ans=0;
	a[0]=0;
	for (int i=1; i<=len; i++){
		if (a[i]!=a[i-1]) continue;
		else a[i]=a[i-1]^1,ans++;
	}
	int ans1=0;
	for (int i=1; i<=len; i++) a[i]=s[i]-'0';
	a[0]=1;
	for (int i=1; i<=len; i++){
		if (a[i]!=a[i-1]) continue;
		else a[i]=a[i-1]^1,ans1++;
	}
	printf("%d\n",min(ans,ans1));
	return 0;
}

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

typedef long long ll;

using namespace std;

#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORd(i,a,b) for(int i=a;i>=b;i--)
#define II pair <int,int>
#define fi first
#define se second

const int maxn=1e5+10;
const ll maxN=1e18+10;
const int MOD=1e9;

bool cmp(II a, II b)
{
    return a.se<b.se;
}

int main()
{
    //freopen("IN.INP","r",stdin);
    //freopen("OUT.OUT","w",stdout);
    int n;
    cin >> n;
    map <string,int> mang;
    set <string> luu;
    int lmax=0;
    FOR(i,1,n) {
        string x;
        cin >> x;
        mang[x]++; luu.insert(x);
        if (lmax<mang[x]) lmax=mang[x];
    }
    for (auto i=luu.begin();i!=luu.end();i++)
        if (mang[*i]==lmax) cout << *i << endl;
}


Measured memory_bytes: 34560
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 a = Math.min(Math.min(A,B),C);
        int c = Math.max(Math.max(A,B),C);
        int b = (A + B + C) - (a + c);

        //bに合わせる
        int count = 0;
        if ((b - a)% 2 == 0) {
            count = (b - a)/2;
        }else{
            count = (b - a + 1)/2 + 1;
        }
        count = count + (c - b);

        System.out.println(count);
    }
}


Measured memory_bytes: 21716
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define test(s) \
  if (!(s))     \
    cout << "Line " << __LINE__ << ": [" << #s << "] is false" << endl;
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion

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

  int MX = 1e+6 + 5;
  vector<int> A(N);

  rep(i, N) {
    cin >> A[i];
  }
  sort(all(A));

  set<int> duplicate;
  rep(i, N - 1) {
    if (A[i] == A[i + 1])
      duplicate.insert(A[i]);
  }

  vector<bool> table(MX + 1, false);
  int ans = 0;
  rep(i, N) {
    if (table[A[i]])
      continue;

    if (duplicate.find(A[i]) == duplicate.end())
      ans++;
    for (int j = A[i]; j <= MX; j += A[i])
      table[j] = true;
  }
  cout << ans << endl;
}

Measured memory_bytes: 5864
#include <iostream>

using namespace std;

int main()
{
	long long int a, b;
	cin>>a>>b;
	long long int length = b - a + 1;
	if(a<=0 && b>=0)
		cout<<"Zero";
	else
	{
		if(a>0)
			cout<<"Positive";
		else
		{
			if(length%2)
				cout<<"Negative";
			else
				cout<<"Positive";
		}
	}
}

Measured memory_bytes: 3572
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,0,n)

#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)

#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
			<< " , " << #y << " = " << (y) << "\n";

const int INF = 1e9;
const double EPS = 1e-10;

VI G[100000];
int main() {
	int n,m;
	cin >> n >> m;
	REP(i, m){
		int a,b;
		cin >> a >> b;
		a--;b--;
		G[a].PB(b);
		G[b].PB(a);
	}

	VI ans;
	set<int> st;
	ans.PB(0);
	st.insert(0);

	while(1){
		bool flag = 1;
		for(auto v : G[ans[0]]){
			if(!EXIST(st, v)){
				ans.insert(ans.begin(), v);
				st.insert(v);
				flag = 0;
				break;
			}
		}
		if(!flag) continue;
		flag = 1;
		for(auto v : G[ans[ans.size()-1]]){
			if(!EXIST(st, v)){
				ans.push_back(v);
				st.insert(v);
				flag = 0;
				break;
			}
		}
		if(!flag) continue;
		break;
	}
	cout << ans.size() << endl;
	for(auto v: ans) cout << v+1 << (v==ans[ans.size()-1] ? "\n" : " ");
}


Measured memory_bytes: 11384
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
    
using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()


int main() {

    int N, M;
    cin >> N >> M;
    
    int connect[N][N];
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            connect[i][j] = 0;
        }
    }
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        a --;
        b --;
        connect[a][b] ++;
        connect[b][a] ++;
    }

    for(int i = 0; i < N; i++){
        int cnt = 0;
        for(int j = 0; j < N; j++){
            cnt += connect[i][j];
        }
        cout << cnt  << endl;
    }

}

Measured memory_bytes: 256
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

S = list(input().strip())

for i in range(len(S)):
    for j in range(i, len(S)+1):
        c = "".join(S[:i] + S[j:])
        if c == "keyence":
            print("YES")
            exit()
print("NO")

Measured memory_bytes: 3444
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

typedef long long int64;

typedef double float64;
typedef long double float128;

const int kMaxN = 1e5+5, kInf = 0x3f3f3f3f;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, a; cin >> n >> a;
    n %= 500;
    if (n <= a) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 256
use proconio::{input, fastout};
use std::cmp::max;

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

    let mut ans = 0;
    let mut count = 0;
    for i in d.iter() {
        if i.0 == i.1 {
            count += 1;
        } else {
            count = 0;
        }

        ans = max(ans, count);
    }

    if ans >= 3 {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

void Main() {
  int n = read<int>();
  vector<int> P(n);
  rep(i, n) P[i] = read<int>() - 1;

  vi A(n), B(n);
  rep(i, n) A[i] = i * 30000;
  rep(i, n) B[n-i-1] = i * 30000;

  //cout << "A:"; rep(ii,sz(A)) cout << ' ' << A[ii]; cout << endl;
  //cout << "B:"; rep(ii,sz(B)) cout << ' ' << B[ii]; cout << endl;

  int psum = -1;

  rep(i, n) {
    int p = P[i];
    int sum = A[p] + B[p];
    if (sum <= psum) {
      int d = psum - sum + 1;
      A[p] += d;
    }
    psum = A[p] + B[p];
  }

  rep(i, n) {
    _p(i+1<n?"%d ":"%d\n", A[i] + 1);
  }

  rep(i, n) {
    _p(i+1<n?"%d ":"%d\n", B[i] + 1);
  }
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 896
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int x;
  cin >> x;
  
  int sum = 0;
  int count = 1;
  while(sum < x){
    sum += count;
    count++;
  }
    count--;
  cout << count;
  
  return 0;
}

Measured memory_bytes: 256