akhauriyash/Code-Regression huggingface dataset:
r,c,n=map(int,input().split())
grid=[input() for _ in [0]*r]
visit=[[grid[i][j]=="X" for j in range(c)] for i in range(r)]
cheese=[None for _ in [0]*(n+1)]

for i in range(r):
    for j in range(c):
        if grid[i][j] in ("X","."):
            continue
        elif grid[i][j]=="S":
            cheese[0]=[i,j]
        else:
            cheese[int(grid[i][j])]=[i,j]
cnt=0

for p in range(n):
    aa,bb=cheese[p]
    cc,dd=cheese[p+1]
    q=[[aa,bb]]
    v=[[visit[i][j] for j in range(c)] for i in range(r)]
    v[aa][bb]=True
    d=[(1,0),(-1,0),(0,1),(0,-1)]
    flag=False
    while q:
        qq=[]
        while q:
            i,j=q.pop()
            for dx,dy in d:
                if 0<=i+dx<r and 0<=j+dy<c:
                    if i+dx==cc and j+dy==dd:
                        flag=True
                    if v[i+dx][j+dy]==False:
                        v[i+dx][j+dy]=True
                        qq.append([i+dx,j+dy])
        q=qq
        cnt+=1
        if flag==True:
            break
print(cnt)


Measured memory_bytes: 33220
#include<cstdio>
int main(int argc, char *argv[])
{
        int a,b,c,count=0;
        scanf("%d%d%d",&a,&b,&c);
        for(int i=a;i<=b;i++)
                if(c%i==0) count++;
        printf("%d\n",count);
        return 0;
}

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

using namespace std;

typedef long long ll;

const ll inf = 1e15;

int main() {
  ios::sync_with_stdio(false); cin.tie(NULL);
  ll n;
  cin >> n;
  vector<string> a(n);
  vector<vector<ll> > adj(n), dist(n, vector<ll>(n, inf));
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    for (ll j = 0; j < n; j++) {
      if (a[i][j] == '1') {
        dist[i][j] = 1;
        adj[i].push_back(j);
      }
    }
  }
  vector<ll> color(n, -1), visited(n), deg(n);
  bool can = true;
  function<void(ll, ll)> dfs = [&](ll u, ll c) {
    visited[u] = 1;
    color[u] = c;
    for (auto v: adj[u]) {
      if (visited[v]) {
        if (color[u] == color[v]) can = false;
      } else {
        dfs(v, c ^ 1);
      }
    }
  };
  dfs(0, 0);
  if (!can) {
    cout << -1 << endl;
    return 0;
  }
  for (ll k = 0; k < n; k++) {
    for (ll i = 0; i < n; i++) {
      for (ll j = 0; j < n; j++) {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < n; j++) {
      if (dist[i][j] == inf || i == j) continue;
      ans = max(ans, dist[i][j]);
    }
  }
  cout << ans + 1 << endl;
  return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long int 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define pqmin priority_queue<int,vector<int>,greater<int>>
#define pqmax priority_queue<int>
using namespace std;
int32_t main()
{
    IOS;
  int n;
  cin>>n;
  int a[n],b[n];
  for(int i=0;i<n;i++)
  {
      cin>>a[i];
      b[i]=a[i];
  }
  for(int i=n-2;i>=0;i--)
  {
      b[i]=b[i]+b[i+1];
  }
  int s=0;
  for(int i=0;i<n-1;i++)
  {
      s+=a[i]*b[i+1];
  }
  cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
using namespace std;
#define INF 1LL << 61
#define MAX 1LL << 30
#define MOD 1000000007
typedef long long ll;
//typedef pair<ll,ll> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll
int dx[]={1,-1,0,0},dy[]={0,0,-1,1};


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

    int H,W,N;
    cin>>H>>W>>N;
    if(H<W) swap(H,W);
    cout<<(N+H-1)/H<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n,ans=0;
    cin >> n;
    vector<int> b(n);
    for(int i=0; i<n;i++){
        cin >> b[i];
    }
    for(int i=0;i<n-1; i++)
    {
        for(int s=i+1; s<n; s++)
        {
            ans+=b[i]*b[s];
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
 int a, b;
 scanf("%d %d", &a, &b);
 double re = (a + b) / 2.0;
 double x = re - (int) re;
 double ans = 0;
 if(x >= .50) ans = ceil(re);
 else ans = floor(re);
 printf("%.0lf\n", ans);
 
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7; 

int main(void){
    int n;
    cin>>n;
    map<int,int> mp;
    for(int i = 2; i <= n; i++){
        int x = i;
        for(int d = 2; d<=x; d++){
            while(x%d == 0){
                mp[d]++;
                x /= d;
            }
        }
    }

    ll res = 1;
    for(auto itr : mp){
        res = res*(itr.second + 1)%mod;
    }
    cout<<res<<endl;

    return 0;
}


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

int main() {
	int n, m;
	cin >> n >> m;
	string s;
	cin >> s;
	vector<int> ans;
	for (int i = n; i > 0; ) {
		int p = i;
		i -= m;
		if (i < 0) i = 0;
		while (s[i] != '0') i++;
		if (i == p) {
			cout << -1 << endl;
			return 0;
		}
		ans.push_back(p-i);
	}
	reverse(ans.begin(), ans.end());
	for (int e : ans) cout << e << endl;
	return 0;
}

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

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

  vector<int> v(N + 1, 0);
  for (int x = 1; x <= 101; x++) {
    for (int y = 1; y <= 101; y++) {
      for (int z = 1; z <= 101; z++) {
        int num = x * x + y * y + z * z + x * y + y * z + z * x;
        if (num <= N) {
          v.at(num)++;
        }
      }
    }
  }

  for (int i = 1; i <= N; i++) {
    cout << v.at(i) << endl;
  }

  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

void add(int &a, int b) {
    a += b;
    while (a >= MOD)
        a -= MOD;
    while (a < 0)
        a += MOD;
}

const int kMaxValue = 2 * 100 * 1000;

int main() {
    int n, m, k; cin >> n >> m >> k;
    
    vector<int> x(k, 0), y(k, 0);

    for (int i = 0; i < k; i += 1) {
        cin >> x[i] >> y[i];
    }

    vector<int> perm(k, 0);
    for (int i = 0; i < k; i += 1)
        perm[i] = i;
    
    vector<int> fact(kMaxValue + 1, 1);
    vector<int> inv(kMaxValue + 1, 1);
    vector<int> inv_fact(kMaxValue + 1, 1);

    for (int i = 2; i <= kMaxValue; i += 1) {
        fact[i] = 1LL * i * fact[i - 1] % MOD;
        inv[i] = (MOD - 1LL * (MOD / i) * inv[MOD % i] % MOD);
        inv_fact[i] = 1LL * inv[i] * inv_fact[i - 1] % MOD;
    }
    
    auto getComb = [&] (int a, int b) {
        if (a < b)
            return 0;
        int ans = 1LL * fact[a] * inv_fact[b] % MOD;
        ans = 1LL * ans * inv_fact[a - b] % MOD;
        return ans;
    };
        
    sort(perm.begin(), perm.end(), [&] (int a, int b) {
        return make_pair(x[a], y[a]) < make_pair(x[b], y[b]);
    });

    perm.push_back(k);
    x.push_back(n);
    y.push_back(m);
    
    k = perm.size();
    vector<int> dp(k, 0);

    for (int i = 0; i < k; i += 1) {
        int idx = perm[i];
        dp[i] = getComb(x[idx] + y[idx] - 2, x[idx] - 1);

        for (int j = 0; j < i; j += 1) {
            if (x[perm[j]] <= x[idx] and y[perm[j]] <= y[idx]) {
                int dx = x[idx] - x[perm[j]];
                int dy = y[idx] - y[perm[j]];
                int coef = 1LL * dp[j] * getComb(dx + dy, dx) % MOD;
                add(dp[i], -coef);
            }
        }

    }

    cout << dp.back() << "\n";
}

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

int main () {
  int64_t W, H, x, y;
  cin >> W >> H >> x >> y;
  cout << fixed << setprecision(10);
  cout << (double)W*H/2 <<" ";
  if(x*2 == W && y*2 == H)
    cout << 1;
  else cout << 0;
}

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

const long long inf = 1e15;

long long n, a[mxN], dp[mxN][mxN], prefix[mxN];

int main() {
	cin >> n;
	for (int i=0; i<n; i++) {
		cin >> a[i];
		prefix[i] = a[i];
		if (i != 0) prefix[i] += prefix[i - 1];
	}
	for (int k=0; k<n; k++) {
		for (int i=0; i<n; i++) {
			if (i + k > n - 1 || k == 0) continue;
			dp[i][i + k] = inf;
			for (int j=i; j<i+k; j++) {
				long long x, y;
				if (i == 0) x = prefix[j];
				else x = prefix[j] - prefix[i - 1];
				y = prefix[i + k] - prefix[j];
				dp[i][i + k] = min(dp[i][i + k], x + y + dp[i][j] + dp[j + 1][i + k]);
			}
		}
	}
	cout << dp[0][n - 1];
}

Measured memory_bytes: 1536
N, K = map(int, input().split())
h = [0] * N
for i in range(N):
    h[i] = int(input())

h = sorted(h)

ans = h[-1]
for i in range(N-K+1):
    ans = min(ans, h[i+K-1] - h[i])

print(ans)


Measured memory_bytes: 8240
#include <iostream>
#include <vector>
#include <string>
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <deque>
#include <tuple>
#include <unordered_set>
#include <array>
#include <string>

using namespace std;
#define ll long long
#define ar array

int main() {
	int n;
	cin >> n;
	cout << !n << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

int main(void){
    char a;
    cin>>a;
    if(a>='A' && a<='Z') cout<<"A"<<endl;
    else cout<<"a"<<endl;
    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch AntiDivision | diff AntiDivision.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address AntiDivision.cpp && ./a.out

/*
 
 6/22/2019
 
 5:09-
 
 */

LL A,B,C,D;
LL gcd(LL a, LL b) {
  return b == 0 ? a : gcd(b, a % b);
}
LL lcm(LL a, LL b) {
  return a/ gcd(a,b)*b;
}
LL f(LL u) {
  LL c=u/C,d=u/D;
  LL l=lcm(C,D);
  LL cd=u/l;
  LL res=u-c-d+cd;
//  dump(u, c, d, l, cd, res);
  return res;
}
void solve() {
  LL l=f(A-1),r=f(B);
  cout<<(r-l)<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>A>>B>>C>>D;
  solve();
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
	 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
#define clr(a) memset(a,0,sizeof(a))
#define umap unordered_map
#define uset unordered_set
#define fr first
#define sc second
#define pb push_back
#define M int(1e9+7)
#define endl '\n'
	
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
	
	
int main(){
	fast_io; cout_precision;
	int n,k;	cin >> n >> k;	cout << (int)floor(log2(n)/log2(k))+1 <<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits>

//インクルードなど
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
//FORAは範囲for文(使いにくかったら消す)
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

//以下、素集合と木は同じものを表す
class UnionFind{
public:
    vector<ll> parent; //parent[i]はiの親
    vector<ll> siz; //素集合のサイズを表す配列(1で初期化)
    map<ll,vector<ll>> group; //集合ごとに管理する(key:集合の代表元、value:集合の要素の配列)
    ll n; //要素数

    //コンストラクタ
    UnionFind(ll n_):n(n_),parent(n_),siz(n_,1){ 
        //全ての要素の根が自身であるとして初期化
        for(ll i=0;i<n;i++){parent[i]=i;}
    }

    //データxの属する木の根を取得(経路圧縮も行う)
    ll root(ll x){
        if(parent[x]==x) return x;
        return parent[x]=root(parent[x]);//代入式の値は代入した変数の値なので、経路圧縮できる
    }

    //xとyの木を併合
    void unite(ll x,ll y){
        ll rx=root(x);//xの根
        ll ry=root(y);//yの根
        if(rx==ry) return;//同じ木にある時
        //小さい集合を大きい集合へと併合(ry→rxへ併合)
        if(siz[rx]<siz[ry]) swap(rx,ry);
        siz[rx]+=siz[ry];
        parent[ry]=rx;//xとyが同じ木にない時はyの根ryをxの根rxにつける
    }

    //xとyが属する木が同じかを判定
    bool same(ll x,ll y){
        ll rx=root(x);
        ll ry=root(y);
        return rx==ry;
    }

    //xの素集合のサイズを取得
    ll size(ll x){
        return siz[root(x)];
    }

    //素集合をそれぞれグループ化
    void grouping(){
        //経路圧縮を先に行う
        REP(i,n)root(i);
        //mapで管理する(デフォルト構築を利用)
        REP(i,n)group[parent[i]].PB(i);
    }

    //素集合系を削除して初期化
    void clear(){
        REP(i,n){parent[i]=i;}
        siz=vector<ll>(n,1);
        group.clear();
    }
};


int main(){
    
    long N,M;
    std::cin >> N >> M;
    UnionFind tree(N);
    for(long i=0; i<M; i++){
        long A,B;
        std::cin >> A >> B;
        tree.unite(A,B);
    }
    tree.grouping();
    std::cout << tree.group.size()-1 << std::endl;
    return 0;
}

Measured memory_bytes: 13868
#include <iostream>
#include <math.h>
#include <algorithm>

using namespace std;

int main(){
  int n;
  string c;
  cin >> n >> c;
  int c1=0,c2=0,c3=0,c4=0;
  for(int i=0;i<n;i++){
    if(c[i] == 'R')
      c1++;
  }
  for(int i=0;i<c1;i++){
    if(c[i] == 'W')
      c2++;
  }
  cout << c2;
  return 0;
}


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

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


Measured memory_bytes: 256
n, *a = map(int, open(0).read().split())
M = max(a)
mcnt = a.count(M - 1)
Mcnt = a.count(M)
if Mcnt + mcnt == n:
	if mcnt == 0:
		if 2 * M <= n or M == n - 1:
			print("Yes")
			exit()
	else:
		if 0 < 2 * (M - mcnt) <= n - mcnt:
			print("Yes")
			exit()
print("No")

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

int main() {
    int A,B;
    cin >> A >> B;

    if (A < 10 && B < 10)cout << A*B << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	x := nextInt()

	for i := x; i < 200000; i++ {
		if isPrime(i) == true {
			fmt.Println(i)
			return
		}
	}

}

func isPrime(a int) bool {
	for i := 2; i < a; i++ {
		if a%i == 0 {
			return false
		}
	}
	return true
}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1776
#include<stdio.h>


int main(void){
  int x;
  int n;
  scanf("%d",&n);
  scanf("%d", &x);
  int i,l;
  int now = 0;
  int count=1;
  for(i=0;i<n;i++){
    scanf("%d", &l);
    now = now + l;
    if(now <= x){
      count=count+1;
    }
  }
  printf("%d", count);
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
using namespace std;
long n,a;
main()
{
	cin>>n;
	long ans=0;
	for(int i=0;i<5;i++)
	{
		cin>>a;
		ans=max(ans,(n-1)/a+1+4);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define per(i,n) for(long long i = (long long)(n-1);i >= 0;--i)
#define REP(i,s,t) for(long long i=s;i<t;i++)
#define PER(i,s,t) for(long long i=s;i>t;--i)
#define all(x) x.begin(),x.end()
#define sp(n) setprecision(n)
typedef long long ll;
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  if(n<=m){cout<<"Yes"<<endl;}
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import networkx as nx
N, M = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(M)]
 
G = nx.Graph()
G.add_nodes_from(range(1, N+1))
G.add_edges_from(l)
pre = nx.predecessor(G, 1)

print('Yes')
for i in range(2, N+1):
  print(pre[i][0])

Measured memory_bytes: 225320
#include <stdio.h>

#define mod 1000000007

int main(void) {
  int n;
  scanf("%d", &n);
  long a[n];
  long b[n];
  scanf("%ld", &a[0]);
  b[0] = a[0];
  for(int i = 1;i < n;i++) {
    scanf("%ld", a + i);
    b[i] = (a[i] + b[i-1]) % mod;
  }
  long result = 0;
  for(int i = 1;i < n;i++) {
    result += a[i] * b[i-1];
    result %= mod;
  }
  printf("%ld\n", result);
  return 0;
}


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

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 RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<pii, int> para;
const int inf = 1e9 + 7;
const int maxN = 1e6 + 5;
string s, t;
int n;
int main() {
	cin>>n;
	cin>>s>>t;
	int ans = 2 * n;
	FOR(i, 0, n) {
		string p = s.substr(i, n - i);
		string r = t.substr(0, n - i);
		if (p == r) {
			ans -= n - i;
			break;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
/*
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

int main()
{
    int n, m, k, ans = 0;
    std::cin >> n >> m;
    std::vector<std::vector<int>> light(m);
    std::vector<int> p(m);

    for (int i = 0; i < m; i++)
    {
        std::cin >> k;
        light[i] = std::vector<int>(k);
        for (int j = 0; j < k; j++)
            std::cin >> light[i][j];
    }

    for (int i = 0; i < m; i++)
        std::cin >> p[i];

    std::vector<int> b;
    for (int i = 0; i < pow(2, n); i++)
    {
        b = std::vector<int>(n, 0);
        int num = i;
        for (int j = 0; num > 0; j++)
        {
            b[j] = num % 2;
            num /= 2;
        }
        // std::cout << " >> ";
        // for (auto itr = b.begin(); itr < b.end(); itr++)
        //     std::cout << *itr << ",";
        // std::cout << std::endl;

        for (int j = 0; j < light.size(); j++)
        {
            int cnt = 0;
            for (k = 0; k < light[j].size(); k++)
            {
                // std::cout << light[j][k] - 1 << ",";
                if (b[light[j][k] - 1])
                    cnt++;
            }
            // std::cout << " >> " << cnt << "(" << cnt % 2 << std::endl;
            if (cnt % 2 != p[j])
                break;
            else if (j == light.size() - 1)
                ans++;
        }
        // std::cout << std::endl;
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using strings = pair<string, string>;

int main() {
    int n;
    long long ans = 0;
    string s;
    cin >> n >> s;
    
    map<strings, long long> mp;
    
    for (int bit = 0; bit < (1<<n); bit++) {
        string r = "", b = "";
        for (int i = 0; i < n; i++) {
            if (bit&(1<<i)) r = r + s[i];
            else b = b + s[i];
        }
        reverse(b.begin(), b.end());
        mp[make_pair(r, b)]++;
    }
    
    for (int bit = 0; bit < (1<<n); bit++) {
        string r = "", b = "";
        for (int i = 0; i < n; i++) {
            if (bit&(1<<i)) r = r + s[i+n];
            else b = b + s[i+n];
        }
        reverse(r.begin(), r.end());
        strings t = make_pair(r, b);
        if (mp.count(t)) ans += mp[t];
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 42624
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;
    ll X;
    cin >> X;

    if (X >= 30) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

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

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


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

void func(long long A, long long B, long long C, long long K){

    lli cnt = 0;
    while(B<=A){
        B*=2;
        cnt++;
    }
    while(C<=B){
        C*=2;
        cnt++;
    }
    if(cnt<=K){
        cout<<YES<<endl;
    }
    else{
        cout<<NO<<endl;
    }

}

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

    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long K;
    scanf("%lld",&K);
    func(A, B, C, K);
    return 0;
}


Measured memory_bytes: 3672
package main

import "fmt"

func main() {
	var d int
	for {
		v, _ := fmt.Scan(&d)
		if v == 0 {
			break
		}
		sum := 0
		for i := 0; i < 600/d; i++ {
			sum += d*d*i*d*i
		}
		fmt.Println(sum)
	}
}


Measured memory_bytes: 1076
import sys
input=sys.stdin.readline

def find_parent(x):
    y=parent[x]
    if y<0:
        return x
    parent[x]=find_parent(y)
    return parent[x]

def connect(a,b):
    c=find_parent(a)
    d=find_parent(b)
    if c==d:
        return
    if parent[c]<parent[d]:
        parent[c]+=parent[d]
        parent[d]=c
    else:
        parent[d]+=parent[c]
        parent[c]=d
    return

def f(S,G):
    que=[S]
    flag=[0]*(N+1)
    L=[0]*(N+1)
    flag[S]=1
    while que:
        H=[]
        for u in que:
            for v,l in data[u]:
                if flag[v]==0:
                    flag[v]=u
                    L[v]=l
                    H.append(v)
                if v==G:
                    break
            else:
                continue
            break
        else:
            que=H
            continue
        break
    qqq=0
    que=G
    while que!=S:
        qqq=max(qqq,L[que])
        que=flag[que]
    return qqq

N,M=map(int,input().split())
X=int(input())

inf=float("inf")
mod=10**9+7

edge=[]
for i in range(M):
    U,V,W=map(int,input().split())
    edge.append([W,U,V])
edge.sort()
parent=[-1]*(N+1)

remain_edge=[]
data=[[] for i in range(N+1)]
weigh=0

for l,a,b in edge:
    if find_parent(a)==find_parent(b):
        remain_edge.append([l,a,b])
        continue
    else:
        connect(a,b)
        weigh+=l
        data[a].append([b,l])
        data[b].append([a,l])
        
if weigh>X:
    print(0)
    sys.exit()
elif weigh==X:
    count=N-1
    for l,a,b in remain_edge:
        if l==f(a,b):
            count+=1
    print(pow(2,M-count,mod)*(pow(2,count,mod)-2)%mod)
else:
    count_1=0
    count_2=0
    count_3=0
    for l,a,b in remain_edge:
        if weigh-f(a,b)+l==X:
            count_1+=1
        elif weigh-f(a,b)+l<X:
            count_2+=1
        else:
            count_3+=1
    print(2*pow(2,count_3,mod)*(pow(2,count_1,mod)-1)%mod)

Measured memory_bytes: 53720
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    long long k, a, b; std::cin >> k >> a >> b;
    if (k <= a - 1) {
        std::cout << k + 1 << std::endl;
        return 0;
    }
    long long ans = a;
    k -= a - 1;
    ans += k/2*std::max(2LL, b - a);
    ans += k & 1;
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;
const int mod = 1000000007;

int main() {

  int N,maximum=1;
  cin>>N;
  vector<pair<int,string>> A(N);
  unordered_map<string, int> map;
  for(int i=0; i<N; i++){
    string a;
    cin>>a;//cout<<a<<endl;
    A[i].second=a;
    if(!map.count(a)){
      map[a]=1;
      A[i].first=1; 
      }
    else {
      map[a]++;
      A[i].first++;
      maximum = max(maximum , map[a]);}
    //cout<<A[i].first<<endl;
  }//cout<<maximum<<endl;
  sort(A.begin(),A.end());  string bef="";
  for(int i=0; i<A.size(); i++){
  
    if(map[A[i].second]==maximum&&bef!=A[i].second){
      cout << A[i].second << endl; bef=A[i].second;}}
}



Measured memory_bytes: 27208
#!/usr/bin/python3
# -*- coding: utf-8 -*-

from decimal import Decimal, ROUND_HALF_UP

def main():
    a, b = map(int, input().split())
    print(Decimal((a + b) / 2).quantize(0, ROUND_HALF_UP))

if __name__ == '__main__':
    main()


Measured memory_bytes: 5588
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll N,M;
  cin >> N >> M;
  int ans_MAX=M/N;
  for(int i=0;i<ans_MAX;i++){
    if(M%(ans_MAX-i)==0){
      cout << ans_MAX-i << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll a, b;
    cin >> a >> b;
    out(max(0LL, a - 2*b));
    re0;
}

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

// Description: ????????????
// Verifyed: various problem 
using namespace placeholders;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const R INF = 1E40L;
const R PI = acos(-1.0L);
using P=complex<R>;
using L=struct{P s,t;};
using VP=vector<P>;
using C=struct{P c;R r;};

auto& operator >> (istream& is,P& p){ R x,y; is >> x >> y,p=P(x,y); return is;}
auto& operator << (ostream& os,P& p){ os << real(p) << " " << imag(p); return os;}

inline R dot(P o,P a,P b){return real(conj(a-o)*(b-o));}
inline R det(P o,P a,P b){return imag(conj(a-o)*(b-o));}
inline P vec(L l){return l.t-l.s;}
auto sdot = bind(sgn,bind(dot,_1,_2,_3));
auto sdet = bind(sgn,bind(det,_1,_2,_3));

//projection verify AOJ CGL_1_A
P proj(L l,P p){ R u=real((p-l.s)/vec(l)); return (1-u)*l.s+u*l.t;}

// vertical parallel
// verified: AOJ CGL_2_A
bool vertical(L a,L b) {return sdot(0,vec(a),vec(b))==0;}
bool parallel(L a,L b) {return sdet(0,vec(a),vec(b))==0;}
bool eql(L a,L b){ return parallel(a,b) and sdet(a.s,a.t,b.s)==0;}

// crossing determination
// verified: AOJ CGL_2_B 
bool iss(L a,L b){
	int sa=sdet(a.s,a.t,b.s)*sdet(a.s,a.t,b.t);
	int sb=sdet(b.s,b.t,a.s)*sdet(b.s,b.t,a.t);
	return max(sa,sb)<0;
}

// crossing point 
// verified: AOJ CGL_2_C
P cross(L a,L b){
	R u=det(a.s,b.s,b.t)/det(0,vec(a),vec(b));
	return (1-u)*a.s+u*a.t;
}
	
// distance 
// verified: AOJ CGL_2_D
R dsp(L l,P p){
	P h=proj(l,p);
	if(sdot(l.s,l.t,p)<=0) h=l.s;
	if(sdot(l.t,l.s,p)<=0) h=l.t;
	return abs(p-h);
}

R dss(L a,L b){return iss(a,b)?0:min({dsp(a,b.s),dsp(a,b.t),dsp(b,a.s),dsp(b,a.t)});}

int main(void){
	int n;
	cin >> n;
	cout.precision(20);
	rep(i,n){
		P a,b,c,d;
		cin >> a >> b >> c >> d;
		L s1={a,b},s2={c,d};
		R ans=dss(s1,s2);
		cout << fixed << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3304
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  long long N;
  cin >> N;
  int ans = INT32_MAX;
  FOR(A, 1, sqrt(N))
  {
    if (N % A != 0)
      continue;
    long long B = N / A;
    int digit = max(to_string(A).size(), to_string(B).size());
    ans = min(ans, digit);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 1e6 + 10;
char s[N];

int main() {
  scanf("%s", s);
  vector<int> a;
  int ret = 0;
  for (int i = 0; s[i]; ++i) {
    int x = s[i] - '0';
    if (a.empty()) {
      a.push_back(x);
    } else {
      if (a.back() != x) {
        ret += 2;
        a.pop_back();
      } else {
        a.push_back(x);
      }
    }
  }
  printf("%d\n", ret);
  return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    vector<ll> kaisuu(n,-1);
    kaisuu.at(0) = 0;
    ll now = 0;
    ll next;
    ll times = 0;
    while(true){
        ++times;
        next = a.at(now)-1;
        if(kaisuu.at(next) == -1){
            kaisuu.at(next) = times;
            now = next;
        }else{
            break;
        }
    }
    if(k < times){
        for(i = 0;i < n;++i){
            if(kaisuu.at(i) == (k%times)){
                cout << i+1 << endl;
                return 0;
            }
        }
    }else{
        ll hazimari = kaisuu.at(next);
        ll syuuki = times-hazimari;
        k -= times;
        k %= syuuki;
        now = next;
        while(k){
            next = a.at(now)-1;
            --k;
            now = next;
        }
        cout << now+1 << endl;
    }

    return 0;
}


Measured memory_bytes: 6420
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll inf = 1e9+7;

int main(){
    int a,b;
    cin>>a>>b;
    if (a <= 5){
        b = 0;
        cout << b;
    }else if (a >= 6 && a <= 12){
        cout << b/2;
    }else{
        cout << b;
    }
}

Measured memory_bytes: 3552
#include <cstdlib>
#include <iostream>
#include <set>
#include <vector>
using namespace std;

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

	for(int n, m; cin >> n >> m, n;) {
		vector<vector<int> > friends(n);
		for(int i = 0; i < m; ++i) {
			int a, b;
			cin >> a >> b;

			friends[a - 1].push_back(b - 1);
			friends[b - 1].push_back(a - 1);
		}

		set<int> person;
		person.insert(0);
		for(int i = 0; i < friends[0].size(); ++i) {
			person.insert(friends[0][i]);
			for(int j = 0; j < friends[friends[0][i]].size(); ++j)
				person.insert(friends[friends[0][i]][j]);
		}

		cout << person.size() - 1 << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1380
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

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 * b / gcd(a, b);
};
//fixed << setprecision(2)



//小文字=大文字+32
int main() {
	int a, b, t;
	cin >> a >> b >> t;
	cout << b * (t /a) ;
}
	



Measured memory_bytes: 3500
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;

int main() {
  int N; scanf("%d", &N);
  map<string, int> C; vector<pair<string, int>> C2;
  char s[11];
  for (int i = 0; i < N; i++) {
    scanf("%s", s);
    string s2(s);
    auto it = C.find(s2);
    if (it == C.end()) C[s2] = 1;
    else C[s2]++;
  }
  for ( auto it = C.begin(); it != C.end(); it++ )
    C2.push_back(*it);
  sort(C2.begin(), C2.end(), [](auto &a, auto &b) {
    if ( a.second == b.second ) return a.first < b.first;
    return a.second > b.second;
  });
  int maxnum = C2[0].second;
  for ( auto it = C2.begin(); it != C2.end(); it++ ) {
    if (it->second != maxnum) break;
    printf("%s\n", it->first.c_str());
  }
}

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


void solve(long long X, long long Y, long long Z){
    cout << (X - Z) / (Y + Z) << endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    long long Z;
    scanf("%lld",&Z);
    solve(X, Y, Z);
    return 0;
}


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

using namespace std;

const int INF = 1001001001;

// Union-Find木
int par[100005];

void init(int num);
int find(int num);
void unite(int x, int y);
bool same(int x, int y);

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> p(n);
    for(int i = 0; i < n; ++i){
        cin >> p[i];
        // 0-indexed
        p[i]--;
    }

    init(n);
    for(int i = 0; i < m; ++i){
        int x, y;
        cin >> x >> y;
        // 0-indexed
        x--;
        y--;
        // unionfind木の作成 
        unite(x, y);
    }

    int res = 0;
    for(int i = 0; i < n; ++i){
        if(same(p[i], i)){
            res++;
        }
    }

    cout << res << endl;
}

void init(int num){
    for(int i = 0; i < num; ++i){
        par[i] = i;
    }
}

int find(int num){
    if(par[num] == num){
        return num;
    }
    else{
        return par[num] = find(par[num]);
    }
}

void unite(int x, int y){
    x = find(x);
    y = find(y);

    if(x == y)      return;
    else{
        par[y] = x;
        return;
    }
}

bool same(int x, int y){
    return find(x) == find(y);
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define ll long long
#define ljc 998244353
using namespace std;
/*
转切比雪夫距离就可以做了。 
直接构造。

左上角R,左下角Y,右上角G,右下角B。 
填充即可。 
*/
#ifdef Fading
#define gc getchar
#endif
#ifndef Fading
inline char gc(){
    static char now[1<<16],*S,*T;
    if (T==S){T=(S=now)+fread(now,1,1<<16,stdin);if (T==S) return EOF;}
    return *S++;
}
#endif
inline ll read(){
    register ll x=0,f=1;char ch=gc();
    while (!isdigit(ch)){if(ch=='-')f=-1;ch=gc();}
    while (isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=gc();}
    return (f==1)?x:-x;
}
int n,m;
const int mx=1100;
char S[4]={'R','Y','G','B'};
signed main(){
    n=read(),m=read();
    int D=read();
    for (int i=1;i<=n;i++){
        for (int j=1;j<=m;j++){
        	int tm1=(((i-j+n+m)/D)%2+2)%2;
        	int tm2=(((i+j+n+m)/D)%2+2)%2;
            printf("%c",S[2*tm1+tm2]);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int n,div,ans;
    cin>>n;
    ans=n;
    while(n>0){
      div+=n%10;
      n=n/10;
    }
    if(ans%div!=0)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
t, a = map(int, input().split())
for i in range(1, n):
    x, y = map(int, input().split())
    i = max(t // x, a // y)
    c, d = x, y
    while c < t or d< a:
        c = x * i
        d = y * i
        i += 1
    t, a = c, d
print(t + a)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
	int N,A,B;
	cin >> N;
	if (N == 1) {
		cout << "Hello World" << endl;
	}else {
		cin >> A >> B;
		cout << A + B << endl;
	}
	return 0;
}

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


void solve(long long N, std::vector<long long> a){
  long long s = 0;
  for (int i = 0; i < N; ++i) {
    s += a[i];
  }

  vector<long long> ret;
  long long first_sum = 0;
  priority_queue<long long, vector<int>, greater<int>> q;
  for (long long i = 0; i < N; ++i) {
    q.push(a[i]);
    first_sum += a[i];
  }
  ret.push_back(first_sum);
  for (long long i = N; i <= 2 * N; ++i) {
    q.push(a[i]);
    first_sum -= q.top();
    first_sum += a[i];
    q.pop();
    ret.push_back(first_sum);
  }

  vector<long long> ret2;
  long long last_sum = 0;
  priority_queue<long long> q_back;
  for (long long i = 0; i < N; ++i) {
    q_back.push(a[3 * N - 1 - i]);
    last_sum += a[3 * N - 1 - i];
  }
  ret2.push_back(last_sum);
  for (long long i = 2 * N - 1; i >= N; --i) {
    q_back.push(a[i]);
    last_sum -= q_back.top();
    last_sum += a[i];
    ret2.push_back(last_sum);
    q_back.pop();
  }
  reverse(ret2.begin(), ret2.end());
  long long ret3 = -1e15;
  for (long long i = 0; i < N + 1; ++i) {
    ret3 = max(ret3, ret[i] - ret2[i]);
  }
  cout << ret3 << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> a(3*N);
  for(int i = 0 ; i < 3*N ; i++){
    scanf("%lld",&a[i]);
  }
  solve(N, std::move(a));
  return 0;
}


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


struct Node{
	int key;
	struct Node *right, *left , *parent;
};

struct Node *root , *NIL;

struct Node * treeMinimum(struct Node *x)
{
	while(x->left != NIL) x = x->left;
	return x;
}

struct Node * find(struct Node *u , int k)
{
	while( u != NIL && k != u->key)
	{
		if( k < u->key)u = u->left;
		else u = u ->right;
	}
	return u;
}

struct Node * treeSuccessor(struct Node *x)
{
	if(x->right != NIL) return treeMinimum(x->right);
	struct Node* y = x->parent;
	while(y != NIL && x == y->right)
	{
		x = y;
		y = y->parent;
	}
	return y;
}

void treeDelete(struct Node *z)
{
	struct Node *y;
	struct Node *x;
	
	if(z->left == NIL || z->right == NIL) y = z;
	else y = treeSuccessor(z);
	
	if( y->left != NIL)
	{
		x = y->left;
	}
	else{
		x = y->right;
	}
	
	if( x != NIL)
	{
		x->parent = y->parent;
	}
	
	if(y->parent == NIL)
	{
		root = x;
	}
	else{
		if( y == y->parent->left)
		{
			y->parent->left = x;
		}
		else{
			y->parent->right = x;
		}
	}
	
	if(y != z)
	{
		z->key = y->key;
	}
	
	free(y);
}	

void insert(int k)
{
	struct Node *y = NIL;
	struct Node *x = root;
	struct Node *z;
	
	z = (struct Node *)malloc(sizeof(struct Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;
	
	while( x != NIL)
	{
		y = x;
		if(z->key < x->key)
		{
			x = x->left;
		}
		else{
			x = x->right;
		}
	}
	z->parent = y;
	if(y == NIL)
	{
		root = z;
	}
	else{
		if(z->key < y->key)
		{
			y->left = z;
		}
		else{
			y->right = z;
		}
	}
}

void inorder(struct Node *u)
{
	if( u == NIL) return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}

void preorder(struct Node *u)
{
	if( u == NIL) return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}

int main(void)
{
	int  n , i , x;
	char com[100];
	char str1[] = "insert";
	char str2[] = "print";
	char str3[] = "delete";
	scanf("%d",&n);
	
	for( i = 0; i < n; i++)
	{
		while(scanf("%s",com) != EOF)
		
		if(com[0] == 'f')
		{
			scanf("%d",&x);
			struct Node *t = find(root,x);
			if( t != NIL) printf("yes\n");
			else printf("no\n");
		}
		else if(strcmp(com,str1) == 0)
		{
			scanf("%d",&x);
			insert(x);
		}
		else if(strcmp(com,str2) == 0)
		{
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
		else if(strcmp(com,str3) ==0)
		{
			scanf("%d",&x);
			treeDelete(find(root,x));
		}
	}
	return 0;
}


Measured memory_bytes: 20476
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll sum (ll m){
    ll ans = 0;
    ll a = 1;
    while(true){
        ans += a;
        if(ans >= m)return a;
        a++;
    }
}
int main(){
    ll x; cin >> x;
    cout << sum(x) << endl;
}

Measured memory_bytes: 256