akhauriyash/Code-Regression huggingface dataset:
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

bool check(string str)
{
	int j = str.size()-1;
	for(int i=0;i<str.size()/2;i++){ //0 to 2
		if(str[i] != str[j]){
			return false;
		}else{
			j--;
		}
	}
	return true;
}

int main(){
	int cnt=0;
	string str;
	string swap;
	while(cin >> str){
		if(check(str)){
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1184
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N, M = map(int, input().split())
A = list(sorted(map(int, input().split())))
S = sum(A)
acc = [0] * (N + 1)
for i in range(1, N + 1):
    acc[i] = acc[i - 1] + A[i - 1]

def check(x):
    total = 0
    cnt = 0
    for a in A:
        l = -1
        r = N
        while r - l > 1:
            m = (l + r) // 2
            if A[m] + a >= x:
                r = m
            else:
                l = m
        cnt += N - r
        total += acc[N] - acc[r]
        total += a * (N - r)
    return (total, cnt)

left = 0
right = 10 ** 6
while right - left > 1:
    mid = (left + right) // 2
    res = check(mid)
    if res[1] >= M:
        left = mid
    else:
        right = mid
res = check(left)
ans = res[0]
print(ans - (res[1] - M) * left)


Measured memory_bytes: 89380
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <set>
#include <utility>
#include <climits>
// #include <numeric>

#define ll long long
#define ull unsigned long long
using namespace std;

int gcd(int a, int b) {
	if (b == 0)
		return a;
	else return gcd(b, a % b);
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int k;
	cin >> k;
	ull sum = 0;
	for (int i = 1; i <= k; ++i) {
		for (int j = 1; j <= k; ++j) {
			for (int w = 1; w <= k; ++w) {
				sum += gcd(gcd(i, j), w);
			}
		}
	}
	cout << sum;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

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 main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    cout << (modpow(10, N, MOD) + MOD - (((modpow(9, N, MOD)*2) % MOD + MOD) - modpow(8, N, MOD) + MOD) % MOD ) % MOD << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
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__)

int h,w;
bool isOK(int y,int x){
    if(y>=0&&y<h&&x>=0&&x<w)return true;
    return false;
}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};

int main(){
    cin>>h>>w;
    int maze[h][w];
    queue<P> Q;
    rep(i,h){
        string s;cin>>s;
        rep(j,w){
            if(s[j]=='#'){
                maze[i][j]=1;
                Q.push(make_pair(i,j));
            }
            else maze[i][j]=0;
        }
    }
    int ans=0;
    while(true){
        int qsz=Q.size();
        rep(i,qsz){
            P p=Q.front();
            Q.pop();
            rep(j,4){
                int newy=p.first+dy[j];
                int newx=p.second+dx[j];
                if(isOK(newy,newx)&&(maze[newy][newx]==0)){
                    maze[newy][newx]=1;
                    Q.push(make_pair(newy,newx));
                }
            }
        }
        if(Q.empty())break;
        ++ans;
    }
    cout<<ans<<endl;
}
            
        



Measured memory_bytes: 12304
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> k(M);                          // kは各電球のスイッチ数
  vector<vector<int>> s(M, vector<int>(0));  // sつながっているスイッチ
  REP(i, M) {
    cin >> k[i];
    REP(j, k[i]) {
      int num;
      cin >> num;
      num--;
      int a = 1 << num;
      s[i].push_back(a);
    }
  }
  vector<int> p(M);
  REP(i, M) { cin >> p[i]; }
  ll ans = 0;
  for (int i = 0; i < 1 << N; i++) {
    bool t = true;
    REP(j, M) {
      int num = 0;
      REP(l, k[j]) {
        if (i & s[j][l]) num++;
      }
      if(num%2!=p[j]){
        t = false;
        break;
      }
    }
    if(!t){
      continue;
    }
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, k, n, c;
  scanf("%lld%lld%lld", &n, &k, &c);
  char s[n + 10];
  scanf("%s", s);
  ll cnt[2][n], las = -1e9;
  cnt[0][0] = cnt[1][n - 1] = 0;
  for(i = 1; i < n; ++i) {
    cnt[0][i] = cnt[0][i - 1];
    if(s[i - 1] == 'o' && i - 1 > las + c) cnt[0][i]++, las = i - 1;
  }
  las = 1e9;
  for(i = n - 2; i >= 0; --i) {
    cnt[1][i] = cnt[1][i + 1];
    if(s[i + 1] == 'o' && i + 1 < las - c) cnt[1][i]++, las = i + 1;
  }
  for(i = 0; i < n; ++i) if(cnt[0][i] + cnt[1][i] < k) printf("%lld\n", i + 1);
  return 0;
}

Measured memory_bytes: 4736
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
  int x,y;

  C2(x,y);
  cout << (x-1) * (y-1) << endl;
  
  ret 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
const int N=2e5+10;
int a[N],res[N];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    cin>>a[i];
    long long c=0;
    for(int i=1;i<=n;i++)
    if(i%2) c+=a[i];
    else    c-=a[i];
    res[1]=c;
    for(int i=1;i<=n-1;i++)
    res[i+1]=2*a[i]-res[i];
    for(int i=1;i<=n;i++)
    cout<<res[i]<<" ";
}

Measured memory_bytes: 4280
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    long long n;
    cin >> n;
    vector <long long> qw (n);
    vector <long long> kn (n);
    long long r=0;
    long long t=0;
    for (int i=0; i<n; ++i)
    {
        cin >> qw[i];
        r+=qw[i];
        r%=1000000007;
        kn[i]=r;
    }
    int y=0;
    for (int i=0; i<n; ++i)
    {
        long long q=(r-kn[i]+1000000007)%1000000007;
        t+=q*qw[i];
        t%=1000000007;
    }
    cout << t << endl;
}


Measured memory_bytes: 6416
import java.util.Scanner;

public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int x = nextInt();
        if(x>=400 && x<=599){
            print(8);
        }
        else if(x<=799){
            print(7);
        }
        else if(x<=999){
            print(6);
        }
        else if(x<=1199){
            print(5);
        }
        else if(x<=1399){
            print(4);
        }
        else if(x<=1599){
            print(3);
        }
        else if(x<=1799){
            print(2);
        }
        else if(x<=1999){
            print(1);
        }
    }

    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
}

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ll Mod = 1000000007LL;
const int N = 2e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;


ll cnt[N];
int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, k;
	cin >> n >> k;
	ll ans = 0;
	for(int i = 1; i <= n; i++) cnt[i%k] ++;
	for(int i = 1; i <= n; i++){
		ll R = i%k;
		ll R2 = (k-R) % k;
		ll R3 = (k-R2) % k;
		if((R3 + R) % k == 0)
			ans += cnt[R3] * cnt[R2];
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cins(ll, n, a);
    Cusum(ll, a, sa);

    ll ans = 0;
    For(i, n-1) ans = (ans + (a[i] * ((sa[n] - sa[i+1]) % MOD)) % MOD) % MOD;
    Cout(ans);
}


Measured memory_bytes: 6416
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;

int main() {
  ll N;
  cin >> N;
  vector<vector<ll> > F(N, vector<ll>(10));
  for (ll i = 0; i < N; i++) {
    for (ll j = 0; j < 10; j++) {
      cin >> F[i][j];
      //cout << F[i][j] << ' ';
    }
    // cout << endl;
  }

  vector<vector<ll> > P(N, vector<ll>(11));
  for (ll i = 0; i < N; i++) {
    for (ll j = 0; j < 11; j++) {
      cin >> P[i][j];
      //cout << P[i][j] << ' ';
    }
    //cout << endl;
  }

  ll ans = -1e15;
  // 少なくとも1回は営業しないと駄目
  for (ll mask = 1; mask < (1 << 10); mask++) {
    ll sum = 0;
    for (ll i = 0; i < N; i++) {
      ll count = 0;
      for (ll j = 0; j < 10; j++) {
        // if (((mask >> j) & 1) == 1 && F[i][j] == 1) {
        if (((mask>>j)&1) && F[i][j]) {
          count++;
        }
      }
      sum += P[i][count];
    }
    ans = max(ans, sum);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005

int main()
{
	ios
	ll n,i,j,ans=0,ans1=0;
	cin>>n;
	ll a[n+1];
	for(i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	vi v;
	for(i=1;i<=n-2;i++)
		if(i%2)
			v.pb(2);
		else
			v.pb(-2);
	if(n%2==0){
		v.pb(-1);v.pb(1);
	}else{
		v.pb(-1);v.pb(-1);
	}
	sort(all(v));
	for(i=0;i<n;i++)
		ans+=v[i]*a[i];
	if(n%2){
		vi v1;v1.pb(1),v1.pb(1);
		for(i=1;i<=n-2;i++)
			if(i%2)
				v1.pb(-2);
			else
				v1.pb(2);
		sort(all(v1));
		for(i=0;i<n;i++)ans1+=v1[i]*a[i];
	}
	ans=max(ans,ans1);
	cout<<ans;
	return 0;
}

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

int main(){
    int N;
    cin>>N;
    long arr[N];
    long sum=0;
    for(int i=0;i<N;++i){
        cin>>arr[i];
        sum+=arr[i];
    }
    sort(arr,arr+N);
    cout<<arr[0]<<" "<<arr[N-1]<<" "<<sum<<endl;
}


Measured memory_bytes: 3232
#include<tuple>
#include<iostream>
#include<vector>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  vector<int> y(n);
  vector<int> h(n);
  int tyusin = 0;
  int sx, sy, sh;
  for(int i = 0; i < n; ++i){
    cin >> x.at(i) >> y.at(i) >> h.at(i);
    if(h.at(i) > 0){
      sx = x.at(i);
      sy = y.at(i);
      sh = h.at(i);
    }
  }

  int tmp;
  bool ans = true;

  for(int i = 0; i < 101; i++){
    for(int j = 0; j < 101; j++){
      tyusin = sh + abs(i - sx) + abs(j - sy);
      ans = true;

      for(int k = 0; k < n; k++){
        tmp = max(tyusin - abs(x.at(k) - i) - abs(y.at(k) - j), 0);

        if(h.at(k) != tmp){
          ans = false;
        }
      }
      if(ans){
        cout << i << " " << j << " " << tyusin << endl;
        return 0;
      }

    }
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int arr[100];
int main()
{

    int n,a,sum=0,mn=0,f=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        if(a%10!=0)
        {
            if(f==0){mn=a;f=1;}
            else if(mn>a){mn=a;}
        }
        sum+=a;
    }

    if(sum%10==0){sum-=mn;}
    if(sum%10==0){sum=0;}
cout<<sum<<endl;
return 0;

}


Measured memory_bytes: 3604
n,k,q=(int(x) for x in input().split())
a=[]
for i in range(q):
    a.append(int(input()))
p=[k-q]*n

for i in range(q):
    p[a[0]-1]+=1
    del a[0]

for i in range(n):
    if p[i]>0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 7852
def insertion_sort(A, N, gap):
    cnt = 0
    for i in range(gap, N):
        tmp = A[i]
        j = i - gap
        while j>=0 and A[j] > tmp:
            A[j+gap] = A[j]
            j = j - gap
            cnt = cnt + 1
        A[j+gap] = tmp
    return cnt

def shell_sort(A, N):
    cnt = 0
    gaps = [int((3**item-1)/2) for item in range(1, 100) if int((3**item-1)/2) <= N][::-1]
    m = len(gaps)
    for gap in gaps:
        cnt = cnt + insertion_sort(A, N, gap)
    print(m)
    print(' '.join([str(gap) for gap in gaps]))
    print(cnt)
    for i in range(0, N):
        print(A[i])


N = int(input())
A = [int(input()) for i in range(N)]

shell_sort(A, N)

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

#define  int        long long int
#define    bp(x)           __builtin_popcountll(x)
 #define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0;
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}

int32_t main()
{
    fast
    int x,k,d;
    cin>>x>>k>>d;
    int xx=x;
    x=abs(x);
    int y=x/d;
    if(y>=k)
        cout<<abs(x-k*d);
    else if(x%d==0)
    {
        k-=y;
        if(k%2==0)
            cout<<"0";
        else    
            cout<<d;
    }
    else
    {
        k-=y;
        if(k%2==0)
            if(xx<0)    cout<<abs(xx+y*d);
            else    cout<<abs(xx-y*d);
        else
            if(xx<0)    cout<<abs(xx+y*d + d);
            else    cout<<abs(xx-y*d -d);
    }
}

Measured memory_bytes: 3636
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(1000000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    n,m = map(int,input().split())
    un = UnionFind(n)
    xyz = [list(map(int,input().split())) for i in range(m)]
    for i in range(m):
        un.union(xyz[i][0]-1,xyz[i][1]-1)
    ans = 0
    for i in range(n):
        if un.findroot(i) == i:
            ans += 1
    print(ans)
if __name__ == "__main__":
    main() 
    
#endline===============================================
    

Measured memory_bytes: 44096
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

const ll mod = 1000000007;

ll h, w;
vector<string> a;

ll dp[1100][1100] = {};

void add (ll &a, ll b) {
    a += b;
    if (a >= mod) a -= mod;
}

int main() {
    cin >> h >> w;
    a.resize(h);
    rep(i, h) cin >> a[i];

    dp[0][0] = 1;
    rep(i, h) {
        rep(j, w) {
            if (i+1 < h && a[i+1][j] == '.') add(dp[i+1][j], dp[i][j]);
            if (j+1 < w && a[i][j+1] == '.') add(dp[i][j+1], dp[i][j]);
        }
    }
    cout << dp[h-1][w-1] << endl;
}

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

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll exp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n>0)
    {
        if(n & 1 ==1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n=n>>1;
    }
    return result;
}



int32_t main()
{
    IOS

    ll n,W;
    cin>>n>>W;
 	ll wt[n],v[n];
 	for(ll i=0;i<n;i++)
 		cin>>wt[i]>>v[i];

 	ll dp[n+1][W+1];

 	for(ll i=0;i<=n;i++)
 	{
 		for(ll w=0;w<=W;w++)
 		{
 			if(i==0||w==0)
 				dp[i][w]=0;
 			else if(wt[i-1]>w)
 				dp[i][w]=dp[i-1][w];	
 			else
 				dp[i][w]=max(v[i-1]+dp[i-1][w-wt[i-1]],dp[i-1][w]);
 		}
 	}   
    
    cout<<dp[n][W]<<endl;
    return 0;
}

Measured memory_bytes: 79232
s = input()

n = len(s)
s1=s[0:int(n/2)]
s2=s[int((n+2)/2):]

t = s[::-1]
t1=s1[::-1]
t2=s2[::-1]

if s==t and s1==t1 and s2==t2:
	print('Yes')
else: 
	print('No')


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

map<int, int> compress(vector<int> v) {
  map<int, int> zip;
  REP(i, v.size()) zip[v[i]] = -1;
  int idx = 0;
  for (auto& p : zip) p.second = idx++;
  return zip;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(n), y(n);
  vector<P> ps(n);
  REP(i, n) {
    cin >> x[i] >> y[i];
    ps[i] = {x[i], y[i]};
  }
  x.push_back(-1e9 - 1);
  y.push_back(-1e9 - 1);
  x.push_back(1e9 + 1);
  y.push_back(1e9 + 1);

  auto zx = compress(x);
  auto zy = compress(y);
  vector<int> xs, ys;
  for (auto p : zx) xs.push_back(p.first);
  for (auto p : zy) ys.push_back(p.first);

  vector<vector<int>> imos(xs.size() + 1, vector<int>(ys.size() + 1, 0));
  for (auto p : ps) imos[zx[p.first] + 1][zy[p.second] + 1]++;

  REP(i, xs.size() + 1) REP(j, ys.size()) imos[i][j + 1] += imos[i][j];
  REP(i, xs.size()) REP(j, ys.size() + 1) imos[i + 1][j] += imos[i][j];

  REP(i, m) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int sx = distance(begin(xs), lower_bound(begin(xs), end(xs), x1));
    int sy = distance(begin(ys), lower_bound(begin(ys), end(ys), y1));
    int tx = distance(begin(xs), upper_bound(begin(xs), end(xs), x2));
    int ty = distance(begin(ys), upper_bound(begin(ys), end(ys), y2));
    int ans = 0;
    ans += imos[sx][sy];
    ans -= imos[tx][sy];
    ans -= imos[sx][ty];
    ans += imos[tx][ty];
    cout << ans << endl;
  }
}



Measured memory_bytes: 101580
#include <bits/stdc++.h>
#include <set>
#include <numeric>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


// const double PI = acos(-1);
// int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
// int a[12][12];

void solve() {
  string s; cin >> s;
  string hitachi = "";
  for (int i= 1; i <=5; i++) {
    hitachi += "hi";
    if (hitachi == s) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;

}


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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int v[100006][4];
int dp[100006][4];
int ff(int n,int i)
{
    if(n<0)return 0;
    int ans=0;
    if(dp[n][i]!=-1)return dp[n][i];
    for(int j=1;j<=3;j++)
    {
        if(j!=i)
        {
            int val=v[n][j]+ff(n-1,j);
            ans=max(val,ans);
          //  cout<<"val = "<<val<<endl;
        }
    }
    dp[n][i]=ans;
    return dp[n][i];
}
int main()
{
    memset(dp,-1,sizeof(dp));
    int N;
    cin>>N;
    for(int i=0;i<N;i++)
    {
        for(int j=1;j<=3;j++)
        {
            cin>>v[i][j];
        }
    }
    int z=ff(N-1,0);
    cout<<z<<endl;
//    for(int i=0;i<N;i++)
//    {
//        for(int j=0;j<3;j++)
//            cout<<v[i][j]<<" ";
//        cout<<endl;
//    }
}


Measured memory_bytes: 11136
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	long long int dp[21][101];
	int  n,m,i,k;
	scanf("%d",&n);
	for(i=0;i<21;i++){
		for(k=1;k<n;k++) dp[i][k]=0;
	}
	scanf("%d",&m);
	dp[m][1]=1;
	for(i=2;i<n;i++){
		scanf("%d",&m);
		for(k=0;k<21;k++){
			if(k-m>=0 && dp[k][i-1]>0)	dp[k-m][i]+=dp[k][i-1];
			if(k+m<21 && dp[k][i-1]>0)	dp[k+m][i]+=dp[k][i-1];
		}
	}
	scanf("%d",&m);
	printf("%lld\n",dp[m][n-1]);
	return 0;
}

Measured memory_bytes: 2768
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N,M = map(int,readline().split())
k = 2**N
dp = [INF for i in range(k)]
dp[0] = 0

for i in range(M):
    a,b = map(int,readline().split())
    c = list(map(int,readline().split()))
    d = sum(1<<(ci-1) for ci in c)
    dpnew = dp[:]
    for j in range(k):
        dpnew[j|d] = min(dp[j]+a,dpnew[j|d])
    dp = dpnew

print(dp[2**N-1] if dp[2**N-1] != INF else -1)




Measured memory_bytes: 3292
n,m = map(int, input().split())
A = list(map(int, input().split()))

votes = sum(A)
tot = 0

for i in range(n) :
    std = votes * (1 / (4*m))
    if(A[i] < std) :
        continue
    tot += 1
if(tot >= m) :
    print("Yes")
else :
    print("No")

Measured memory_bytes: 9112
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<(b)?(a=b,1):0)
#define chmin(a,b) (a>(b)?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
const double EPS = 1e-8;
const double PI = acos(-1);
typedef pair<int,int> pii;
typedef long long ll;

int trie[1000][26];
int id[1000];
int total;
void insert(const string &s, int idd) {
  int pos = 0;
  FOR(it, s) {
    int k = *it - 'A';
    if (!trie[pos][k]) {
      total++;
      trie[pos][k] = total;
    }
    pos = trie[pos][k];
  }
  id[pos] = idd;
}

char c[4][4];
map<string,int> mp;
int score[100];
int len[100];
ll num[100];
typedef pair<pii,int> P;

bool trace[4][4];

void check(int i, int j, int h, int pos) {
  int k = c[i][j]-'A';
  if (!trie[pos][k]) return;
  pos = trie[pos][k];
  if (id[pos] >= 0) {
    num[id[pos]]++;
  }
  if (h == 7) return;
  trace[i][j] = 1;  
  for (int ii=i-1;ii<=i+1; ++ii) {
    for (int jj=j-1; jj<=j+1; ++jj) {
      if (ii==i&&jj==j) continue;
      if (valid(ii,jj,4,4) && !trace[ii][jj]) {
        check(ii,jj,h+1,pos);
      }
    }
  }
  trace[i][j] = 0;
}

ll dp[10001];
int deq[100000];
ll deqv[100000];

int main() {
  int n;
  while(cin>>n) {
    total = 0;
    memset(trie,0,sizeof(trie));
    memset(id,-1,sizeof(id));
    REP(i,n) {
      string s;
      int w;
      cin >> s >> w;
      insert(s,i);
      score[i] = w;
      len[i] = s.size();
      num[i] = 0;
    }
    REP(i,4) {
      REP(j,4)
        cin >> c[i][j];
    }
    REP(i,4)REP(j,4)check(i,j,0,0);
    // REP(i,n) {
    //   cout << len[i] << " " << score[i] << " " << num[i] << endl;
    // }
    int T;
    cin >> T;
    memset(dp,0,sizeof(dp));
    REP(i,n) {
      REP(a,len[i]) {
        int s = 0, t = 0;
        for (int j=0; j*len[i]+a <= T; ++j) {
          ll val = dp[j*len[i]+a] - j*score[i];
          while(s<t && deqv[t-1] <= val) t--;
          deq[t] = j;
          deqv[t++] = val;
          dp[j*len[i]+a] = deqv[s] + j*score[i];
          if (deq[s] == j-num[i])
            s++;
        }
      }
    }
    cout << dp[T] << endl;
  }
}

Measured memory_bytes: 1460
#include<bits/stdc++.h>
using namespace std;
inline int read() {
    int x=0,f=1;
    char c=getchar();
    for (;!isdigit(c);c=getchar()) if (c=='-') f=-1;
    for (;isdigit(c);c=getchar()) x=x*10+c-'0';
    return x*f;
}
const int maxn=1e5+10;
const int maxq=1e5+10;
int n,m,q,one,c;
namespace uns {
    int f[maxn];
    void init() {
        for (int i=1;i<=n;++i) f[i]=i;
    }
    int find(int x) {
        return f[x]==x?x:(f[x]=find(f[x]));
    }
    bool same(int x,int y) {
        x=find(x),y=find(y);
        return x==y;
    }
    void merge(int x,int y) {
        x=find(x),y=find(y);
        f[x]=y;
    }
}
struct query {
    int a,b,c;
    inline bool operator < (const query &q) const {
        return c<q.c;
    }
    void input() {
        a=read(),b=read(),c=read();
    }
} req[maxq];
void No() {
    puts("No");
    exit(0);
}
int main() {
    n=read(),m=read(),q=read(),c=n;
    uns::init();
    for (int i=1;i<=q;++i) req[i].input();
    sort(req+1,req+q+1);
    for (one=1;one<=q && req[one].c==0;++one);
    for (int i=1;i<one;++i) {
        int x=req[i].a,y=req[i].b;
        if (uns::same(x,y)) continue;
        --c,uns::merge(x,y);
    }
    bool valid=false;
    for (int i=one;i<=q;++i) {
        int x=req[i].a,y=req[i].b;
        if (uns::same(x,y)) No();
        valid=true;
    }
    long long mx=(long long)c*(c-1)/2-c+n;
    if (m>mx) No();
    if (valid && m<n) No();
    if (!valid && m<n-1) No();
    puts("Yes");
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

const int MAX_N = 1e3;
vector<int> es[MAX_N];
int X[MAX_N];
bool able = true;

pii dfs(int now){
    vector<int> v;
    int sum = 0, S = 0;
    for(auto &e: es[now]){
        pii p = dfs(e);
        sum += p.first;
        S += p.first + p.second;
        v.pb(p.second-p.first);
    }
    if(sum > X[now]) {able = false; return pii(0, 0);} 
    int n = X[now]-sum;
    bool make[n+1];
    fill_n(make, n+1, false);
    make[0] = true;
    for(auto &e: v){
        rep3(i, n, 0){
            if(make[i] && i+e <= n) make[i+e] = true; 
        }
    }
    pii res;
    rep3(i, n, 0){
        if(make[i]){
            res = pii(X[now], S-sum-i);
            if(res.second < res.first) swap(res.first, res.second);
            break;
        }
    }
    //cout << now << ' ' << res.first << ' ' << res.second << endl;
    return res;
}

int main(){
    int N;
    cin >> N;
    rep(i, N-1){
        int p; cin >> p; p--;
        es[p].pb(i+1);
    }
    rep(i, N) cin >> X[i];
    pii p = dfs(0);
    //cout << p.first << ' ' << p.second << endl;
    if(able) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <math.h>
#include <iomanip>
using namespace std;


int main() {
    int a;
    int b;
    int x;
    cin >> a >> b >> x;
    long double A = double(a);
    long double B = double(b);
    long double X = double(x);
    long double tan = 0;
    if (X > 0.5 * A * A * B){
        tan = 2 * ( A * A * B  - X)/(A*A*A);
    } else {
        tan = (A*B*B)/(2*X);
    }
    cout <<  setprecision(10) <<180 * atan(tan)/M_PI << endl;
    return 0;
}

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

int main() {
  string s, t;
  cin >> s >> t;
    
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  
  if(s < t) 
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
import numpy as np
yes, no = "Yes", "No"
n = int(input())
a = np.array(list(map(int, input().split())))
b = np.array(list(map(int, input().split())))
sb = np.sort(b)
sa = np.sort(a)
sbi = np.argsort(b)
sai = np.argsort(a[sbi])
if np.any(sb < sa):
    print(no)
    exit(0)

if np.any(sb[:-1] >= sa[1:]):
    print(yes)
    exit(0)

count = 1
i = 0
while True:
    j = sai[i]
    if j == 0:
        break
    i = j
    count += 1
if count == n:
    print(no)
else:
    print(yes)


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)turn idx;
#define deg_to_rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad_to_deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)

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;
};

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

  vector<int> s(N);
  rep(i, 0, N) {
    s[i] = (int) S[i] - 48;
  }

  int ans = 0;

  rep(i, 0, 1000) {
    // 文字列にする
    string tmp = to_string(i);
    // 比べるint列
    vector<int> tmp2(3, 0);

    rep(j, 0, tmp.size()) {
      tmp2[2 - j] = tmp[tmp.size() - 1 - j] - 48;
    }

    // rep(j, 0, 3) {
    //   cout << tmp2[j];
    // }
    // cout << endl;

    int idx = 0;
    rep(j, 0, N) {
      int num = s[j];
      if (tmp2[idx] == num) {
        idx += 1;
        if (idx > 2) {
          ans += 1;
          break;
        }
      }
    }
  }

  cout << ans << endl;
};


Measured memory_bytes: 384
#include <iostream>
#include <unordered_set>
#include <cstdint>
#include <vector>
#include <string>
#include <climits>
#include <set>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	unordered_set<int> niz;

	for (int i = 1; i <= 9; i++)
		for (int j = 1; j <= 9; j++)
			niz.insert(i * j);

	if (niz.find(n) != niz.end())
		cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 3660
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }

int main(void){
	int h1=nextint();
	int m1=nextint();
	int h2=nextint();
	int m2=nextint();
	int k=nextint();
	int ans=(h2-h1)*60+(m2-m1)-k;
	printf("%d\n", ans);
}


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

using namespace std;

int N, M, R;

int r[10];
long long int A[40000], B[40000], C[40000];

long long int d[222][222];

int main(void) {

	cin >> N >> M >> R;

	int tmp;
	for (int i = 1; i <= R; i++) {
		cin >> tmp; r[i] = tmp;
	}

	for (int i = 1; i <= M; i++) {
		cin >> tmp; A[i] = tmp;
		cin >> tmp; B[i] = tmp;
		cin >> tmp; C[i] = tmp;
	}

	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			if (i == j) { d[i][j] = 0; }
			else { d[i][j] = 202 * 1000000; }
		}
	}


	for (int i = 1; i <= M; i++) {
		d[A[i]][B[i]] = min(d[A[i]][B[i]],C[i]);
		d[B[i]][A[i]] = d[A[i]][B[i]];
	}

	for (int k = 1; k <= N; k++) {
		for (int j = 1; j <= N; j++) {
			for (int i = 1; i <= N; i++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
				//d[j][i]= min(d[j][i], d[j][k] + d[k][i]);
			}
		}
	}

	/*for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			cout << " " << d[i][j];
		}
		cout << endl;
	}*/

	
	vector<int> V;

	for (int i = 1; i <= R; i++) { V.push_back(i); }

	long long int ans = 202 * 10000000;
	long long int sum;
	int count = 0;
	do {
		
		//for (int i = 0; i < R; i++) {	cout << " " << r[V[i]];}  cout << endl;
		sum = 0;
		for (int i = 0; i < R - 1; i++) {
			//cout << "V[i]= " << V[i] << " V[i+1]= " << V[i + 1] << endl;
			sum += d[r[V[i]]][r[V[i + 1]]];
		}
		//cout << "sum= " << sum << endl;
		ans = min(ans, sum);
	} while (next_permutation(V.begin(), V.end()));

	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var str = IO.GetIntList();

            Console.WriteLine((str[0]+str[1]-1)/str[1]);
        }

    }

    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 13268
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

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

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        int D = scan.nextInt();
        int turn = 0;
        while (0 < A && 0 < C) {
            if (turn == 0) {
                C -= B;
                turn = 1;
            } else {
                A -= D;
                turn = 0;
            }
        }
        if (A <= 0) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 27112
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using vi = vector<int>;

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;}

#define P (1'000'000'007)

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

    int ans = 0;
    rep(i, n) {
        capi(h);
        if (h >= k) ++ans;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 3156
#include <iostream>
#include <string>

int main() {
    int N, K;
    std::string S;
    std::cin >> N >> S >> K;
    char SK = S[K - 1];
    for (int i = 0; i < N; ++i) {
        if (S[i] != SK) {
            S[i] = '*';
        }
    }
    std::cout << S << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int a[101],b[10];
int main(){
  int n,c,i;

  for(i=1;i<=9;i++){
	   scanf("%d",&n);
	    a[n]=i;
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
  	scanf("%d",&c);
  	b[a[c]]=1;
  }
  if((b[1]*b[2]*b[3])==1||(b[4]*b[5]*b[6])==1||(b[7]*b[8]*b[9])==1||(b[1]*b[4]*b[7])==1||(b[2]*b[5]*b[8])==1||(b[3]*b[6]*b[9])==1||(b[1]*b[5]*b[9])==1||(b[3]*b[5]*b[7])==1){
  	printf("Yes\n");
  }else{
  	printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 128
import math

a, b, h, m = map(int,input().split())

mins = 60 * h + m

short_kaku = mins * 0.5
short_x = a * (math.cos(math.radians(90 - short_kaku)))
short_y = a * (math.sin(math.radians(90 - short_kaku)))

long_kaku = (mins % 60) * 6
long_x = b * (math.cos(math.radians(90 - long_kaku)))
long_y = b * (math.sin(math.radians(90 - long_kaku)))

pre_ans = (short_x - long_x) ** 2 + (short_y - long_y) ** 2
ans = pow(pre_ans, 0.5)

print(ans)

Measured memory_bytes: 9532
#include <iostream>
#include <string>

using namespace std;

int main() {
	string S;
	cin >> S;
	if (S.find_first_of('a') != string::npos && S.find_first_of('b') != string::npos && S.find_first_of('c') != string::npos){
		cout << "Yes";
	}else{
		cout << "No";
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int A, B;
  cin >> A >> B;
  
  if(abs(A-B) % 2 == 0){
    cout << abs((A+B)/2) << endl;
  } else {
   	cout << "IMPOSSIBLE" << endl;
  }
  
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int L;

int bitct(int a) {
	int rtn = 0;
	while (a > 0) {
		if (a & 1)rtn++;
		a >>= 1;
	}
	return rtn;
}

int main() {
	cin >> L;
	int N = 0, M = 0;
	while ((1 << N) <= L)N++;
	N--;
	M = N * 2 + bitct(L) - 1;

	cout << N + 1 << " " << M << endl;

	for (int i = 0; i < N; i++) {
		cout << i + 1 << " " << i + 2 << " " << (1 << i) << endl;
		cout << i + 1 << " " << i + 2 << " " << 0 << endl;
	}

	int ct = (1 << N);

	for (int i = N - 1; i >= 0; i--) {
		if (L & (1 << i)) {
			cout << i + 1 << " " << N + 1 << " " << ct << endl;
			ct += (1 << i);
		}
	}

	return 0;
}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const int64 infll = (1LL << 61) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    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;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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 V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

inline int64 count3_2(int64 n, int64 k) {
  if(n > k) return (0);
  return (1);
}

int main() {
  int N, K;
  cin >> N >> K;
  cout << count3_2(N, K) << endl;
}






Measured memory_bytes: 3104
n,m=map(int,input().split())
maxi=0
import math
num=math.sqrt(m)
nums=math.floor(num)

for i in range(1,nums+1):
    if m%i==0:
        number1=i
        number2=m//i
        #二つの約数について比べる
        #number1<number2
        #m//number1>m//number2
        if m//number1>=n and m//number2>=n:
            maxi=max(number2,maxi)
        elif m//number1>=n and m//number2<n:
            maxi=max(maxi,number1)
        
    else:
        continue
print(maxi)

Measured memory_bytes: 3064