akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

int dx8[8] = { -1,-1,-1, 0, 1, 1, 1, 0 };
int dy8[8] = { -1, 0, 1, 1, 1, 0,-1,-1 };
//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int H, W; cin >> H >> W;
	vector<vector<int>>field(H+2, vector<int>(W + 2));
	vector<vector<int>>nums(H + 2, vector<int>(W + 2));
	for (int i = 0; i < H; ++i) {
		string st; cin >> st;
		for (int j = 0; j < W; ++j) {
			if (st[j] == '.') {

			}
			else {
				field[i + 1][j + 1] = st[j] - '0';
				nums[i+1][j+1] = st[j] - '0';
			}
		}
	}
	queue<pair<int, int>>que;
	vector<vector<int>>newnums(nums);
	for (int y = 1; y < H + 1; ++y) {
		for (int x = 1; x < W + 1; ++x) {
			if (nums[y][x] <= 0) {
				for (int way = 0; way < 8; ++way) {
					const int ax = x + dx8[way];
					const int ay = y + dy8[way];
					newnums[ay][ax]--;
					if (!newnums[ay][ax]) {
						que.push(make_pair(ax, ay));
					}
				}
			}
		}
	}
	nums = newnums;
	int ans = 0;
	while (!que.empty()) {
		queue<pair<int, int>>newque;
		while (!que.empty()) {
			auto p(que.front());
			que.pop();
			const int x = p.first;
			const int y = p.second;
			for (int way = 0; way < 8; ++way) {
				const int ax = x + dx8[way];
				const int ay = y + dy8[way];
				nums[ay][ax]--;
				if (!nums[ay][ax]) {
					newque.push(make_pair(ax, ay));
				}
			}
		}
		que = newque;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 14844
#include <iostream>
#include <ostream>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << "Yes\n2\n1 1\n1 1\n" << flush;
    return 0;
  }
  if (n == 2) {
    cout << "No\n" << flush;
    return 0;
  }
  ll t = 2;
  while (t * (t - 1) / 2 < n) {
    t++;
  }
  if (t * (t - 1) / 2 != n) {
    cout << "No\n" << flush;
    return 0;
  }
  cout << "Yes\n" << t << endl;
  vector<vector<int>> a(t, vector<int>());
  int cnt = 1;
  for (int i = 0; i < t - 1; i++) {
    for (int j = i + 1; j < t; j++) {
      a[i].push_back(cnt);
      a[j].push_back(cnt);
      cnt++;
    }
  }
  for (auto i : a) {
    cout << t - 1 << " ";
    for (auto itr : i) {
      cout << itr << " ";
    }
    cout << endl;
  }
}


Measured memory_bytes: 2304
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
long long int a[51];
int main()
{
    long long int n;
    while(scanf("%lld",&n)==1)
    {
        memset(a,0,sizeof(a));
        for(long long int i=1;i<=50;i++)
            a[i]=49+n/50;

        long long int m=n%50;
        long long int j;
        for(int i=1;i<=50;i++) a[i]=a[i]-m;
        for(j=1;j<=m;j++)a[j]+=51;

        printf("50\n");
        for(int i=1;i<=50;i++)printf("%lld ",a[i]);
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main() {
  int n;
  cin >> n;
  
  vector<ll> p(200001);
  p[0]=0;
  
  ll x;
  string s;
  int m;
  
  repo(i,200001){
  x=0;  
  s=to_string(i);
  m=s.size();
    if(s[0]==s[m-1]){
      if(m==1) x++;
      if(m==2) x+=3;
      if(m==3) x+=(s[1]-'0'+2)*2+1;
      if(m==4) x+=((s[1]-'0')*10+s[2]-'0'+12)*2+1;
      if(m==5) x+=((s[1]-'0')*100+(s[2]-'0')*10+s[3]-'0'+112)*2+1;
      if(m==6) x+=((s[1]-'0')*1000+(s[2]-'0')*100+(s[3]-'0')*10+s[4]-'0'+1112)*2+1;
    }
    else{
      if(m==2 && s[0]>s[1] && s[1]!='0') x+=2;
      if(m==3 && s[0]<s[2] && s[2]!='0') x+=2;
      if(m==3 && s[0]>s[2] && s[2]!='0') x+=22;
      if(m==4 && s[0]<s[3] && s[3]!='0') x+=22;
      if(m==4 && s[0]>s[3] && s[3]!='0') x+=222;
      if(m==5 && s[0]<s[4] && s[4]!='0') x+=222;
      if(m==5 && s[0]>s[4] && s[4]!='0') x+=2222;
      if(m==6 && s[5]!='0') x+=2222;
    }
  p[i]=p[i-1]+x;
  }
    
  cout << p[n] << endl;
  
}


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

int min_cost(int* h , int n)
{
    int*dp = new int[n];
    //Base Case
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for(int i=2 ; i<n; ++i)
        dp[i] = min( dp[i-1] + abs(h[i] - h[i-1]) ,
                    dp[i-2] + abs(h[i] - h[i-2]));
    return dp[n-1];
} 

int main()
{
    int n;
    cin>>n;
    int* h = new int[n];
    for(int i = 0 ;i<n ;++i)
        cin>>h[i];
    cout << min_cost (h,n) <<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
typedef long long ll;
const ll MOD = 1e9+7;

ll fact(ll n){
    ll ret = 1LL;
    for(ll i = 1; i <= n; ++i) ret *= i;
    return ret;
}

double dist(int x1, int y1, int x2, int y2){
    return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

int main(){
    ll n; cin >> n;
    vector<ll> x(n), y(n); rep(i,n) cin >> x[i] >> y[i];
    double ans = 0;
    rep(i,n){
        rep(j,n){
            ans += fact(n-1)*dist(x[i],y[i],x[j],y[j]);
        }
    }
    ans /= double(fact(n));
    cout << fixed << setprecision(9) << ans << endl;
}

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

const long long INF = __LONG_LONG_MAX__;

using namespace std;

int main() {
    int N;
    cin >> N;
    int d[N];
    for(int i = 0; i < N; i++) cin >> d[i];

    sort(d, d+N);

    int lower = d[N/2 - 1];
    int upper = d[N/2];

    cout << upper - lower << endl;

    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void){
	int c,r;
	while(scanf("%d %d",&c,&r) != EOF){
		if((c==0)&&(r==0)){
			return 0;
		}
		if((c*r)%2){
			printf("no\n");
		}
		else{
			printf("yes\n");
		}
	}
}

Measured memory_bytes: 584
def main():
    k, n = map(int, input().split())
    num_list = list(map(int, input().split()))

    num_list.append(k+num_list[0])

    tmp = 0
    for i in range(n):
        tmp = max(tmp, num_list[i+1]-num_list[i])

    print(k-tmp)

if __name__ == '__main__':
    main()

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

double P, E, T;

double dfs(int rest, double lb, double ub){
    double H = (lb + ub) / 2.0;

    if(rest == 0){
        if(abs(T - H) < E) return 1.0;
        else return 0.0;
    }

    if(T - E <= lb && ub <= T + E) return 1.0;
    else if(ub < T - E || T + E < lb) return 0.0;

    if(H <= T){
        return P * dfs(rest - 1, lb, H) + (1.0 - P) * dfs(rest - 1, H, ub);
    }
    else{
        return P * dfs(rest - 1, H, ub) + (1.0 - P) * dfs(rest - 1, lb, H);
    }
}

int main(void){
    for(int K, L, R; cin >> K >> L >> R >> P >> E >> T; printf("%f\n", dfs(K, L, R)));

	return 0;
}

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

int main()
{
  double t ,x;
  cin >> t >> x;
  cout << t / x << endl;
}


Measured memory_bytes: 3764
def allmultiply():
	setmulti = set()
	for i in range(1,10):
		for j in range(1,10):
			setmulti.add(i*j)
	return setmulti

if __name__ == '__main__':
  N = int(input())
  setmulti = allmultiply()
  if N in setmulti:
  	print('Yes')
  else:
  	print('No')

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

typedef long long ll;
typedef long double ld;

#define FIO         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ALL(v)      v.begin(), v.end()
#define PB          push_back
#define MP          make_pair
#define UB          upper_bound
#define LB          lower_bound
#define PI          2*acos(0.0)
#define MOD         1000000007
#define GCD(a, b)   __gcd(a, b)
#define LCM(a, b)   ((a)*(b)) / GCD(a, b)
#define INPUT       freopen("input.txt", "r", stdin);
#define OUTPUT      freopen("output.txt", "w", stdout);
#define PRINT(a)    for(auto i : a) cout << i << " "; cout << endl;
#define PRINTS(s)   for(auto i=s.begin(); i!=s.end(); i++) cout << *i << " "; cout << endl;
#define PRINTM(m)   for(auto i=m.begin(); i!=m.end(); i++) cout << i->first << " " << i->second << endl;

int month[] = {31,28,31,30,31,30,31,31,30,31,30,31};
string lowerCase = "abcdefghijklmnopqrstuvwxyz";
string upperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

/// Graph moves
const int fxKing[] = {+1,+1,+0,-1,-1,-1,+0,+1}; /// King's move
const int fyKing[] = {+0,+1,+1,+1,+0,-1,-1,-1}; /// King's move
const int fxKnight[] = {+2,+1,-1,-2,-2,-1,+1,+2}; /// Knight's move
const int fyKnight[] = {+1,+2,+2,+1,-1,-2,-2,-1}; /// Knight's move

ll power(ll a, ll b, ll m)
{
    ll ans = 1;
    while(b > 0)
    {
        if(b&1) ans = (ans*a) % m;
        a = (a*a) % m;
        b /= 2;
    }
    return ans;
}

int main()
{
    FIO;
    ll m = 1e9+7, n;
    int t = 1;
//    cin >> t;
    while(t--)
    {
        cin >> n ;
        ll ans = ((power(10ll,n,m) - 2ll*power(9ll,n,m) + power(8ll,n,m)) % m + m) % m;
        cout << ans << endl;
    }

    return 0;
}


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

int main(){
    string str;
    cin >> str;
    int n = 0;
    for(int i = 0; i < str.size(); i++){
        if(str.at(i) == '1'){
            n++;
        }
    }
    cout << n << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    string s;
    cin >> s;
    int n   = s.size();
    int ret = n;
    for (int i = 1; i < n; ++i) {
        if (s[i] != s[i - 1]) {
            chmin(ret, max(i, n - i));
        }
    }
    cout << ret << "\n";
    return 0;
}

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

using namespace std;

int main() {
    int n, mod;
    cin >> n >> mod;
    vector<int> f(n, 0);
    for (int i = 0; i < n; ++i) {
        f[i] = 1;
    }
    for (int j = 1; j < n - 1; ++j) {
        for (int k = min(j + 1, n - j), i = k; i < n; ++i) {
            f[i] = (f[i] + f[i - k]) % mod;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        ans = (ans + (1ll * f[i] * (n - i)) % mod) % mod;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
  int a, b, c;
  std::cin >> a >> b >> c;
  if (a == b && b == c) {
    std::cout << "No" << std::endl;
    return 0;
  }
  if (a == b || b == c || c == a) {
    std::cout << "Yes" << std::endl;
    return 0;
  }
  std::cout << "No" << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N ;
  vector<int> l(N);
  vector<int> r(N);
  for ( int i=0 ; i < N ; i++ ) {
    cin >> l.at(i) >> r.at(i) ;
  }
  int l_sum = accumulate(l.begin(), l.end(), 0);
  int r_sum = accumulate(r.begin(), r.end(), 0);
  cout << r_sum-l_sum+N << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int gcd( int x, int y ){ return y ? gcd(y, x%y) : x; }
signed main() {
int x=0,y=0,z=0,w=0,n=0,m=0;
std::cin >>x;
if(x<=999)std::cout << "ABC" << '\n';
else std::cout << "ABD" << '\n';
}


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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define popcnt __builtin_popcount
#define getBit(x, k) ((x >> k) & 1)
#define all(x) (x).begin(),(x).end()
// ---------------------------------

void Main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for (char i = '0'; i <= '9'; i++)
  for (char j = '0'; j <= '9'; j++)
  for (char k = '0'; k <= '9'; k++) {
    int cnt = 0;
    for (int h = 0; h < n; h++) {
      if (cnt == 2 && s[h] == k) cnt++;
      if (cnt == 1 && s[h] == j) cnt++;
      if (cnt == 0 && s[h] == i) cnt++;
    }
    if (cnt == 3) ans++;
  }
  cout << ans << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  cerr << "- ---- -- ----- <3\n";
#endif
  cin.tie(0)->sync_with_stdio(0);
  int T = 1;
  // cin >> T;
  while (T--) Main();
}


Measured memory_bytes: 3700
def resolve():

    n = int(input())
    ai = list(map(int, input().split()))

    ans = [0] * n

    for i in range(n)[::-1]:

        bit = sum(ans[i:n:i+1]) % 2
        if bit != ai[i]:
            ans[i] = 1

    print(sum(ans))

    if sum(ans) != 0:
        ans_index = [i+1 for i, x in enumerate(ans) if x == 1]
        print(' '.join(map(str, ans_index)))
        
resolve()

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))

#define MOD 1000000007
#define INF 1000000000

ll N;
string S1, S2;
vector<int> pattern;
int main()
{
    cin >> N >> S1 >> S2;
    REP(i, S1.length()) {
        if(S1[i] == S2[i]) {
            pattern.push_back(1);
        } else {
            pattern.push_back(2);
            i++;
        }
    }
    ll ans = 0;
    if(pattern[0] == 1) { ans = 3; }
    else { ans = 6; }
    for(int i = 1; i < pattern.size(); ++i) {
        if(pattern[i-1] == 1 && pattern[i] == 1) {
            ans *= 2;
        }
        else if(pattern[i-1] == 1 && pattern[i] == 2) {
            ans *= 2;
        }
        else if(pattern[i-1] == 2 && pattern[i] == 1) {
            ans *= 1;
        }
        else if(pattern[i-1] == 2 && pattern[i] == 2) {
            ans *= 3;
        }
        ans %= MOD;
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int main()
{
	int n;
	long d;
	scanf("%d%ld", &n, &d);
	d *= d;

	int i;
	int count = 0;
	for (i = 0; i < n; i++) {
		long x, y;
		scanf("%ld%ld", &x, &y);
		if (x * x + y * y <= d)
			count++;
	}

	printf("%d\n", count);

	return 0;
}

Measured memory_bytes: 1688
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define mp make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<30)
#define LLINF (1LL<<60)
//#define MOD 998244353
#define MOD 1000000007
#define PI 3.14159265358979
using ll = long long;
using namespace std;

int main(){
    ll n;
    cin>>n;
    vector<int> prime;
    int limit=sqrt(n);
    for(int i=2;i<=limit;i++){
        if(n%i==0){
            int count=0;
            while(n%i==0){
                n/=i;
                count++;
            }
            prime.push_back(count);
        }
    }
    if(n!=1)prime.push_back(1);
    int ans=0;
    rep(i,prime.size()){
        int t=1;
        while(t*(t+1)/2<=prime[i]) t++;
        ans+=t-1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3680
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

ll N, M, K, i, j, k, l, ans, cnt = 0;

int main(){
    //cin >> ;
    //cout << ans << endl;
    string s1, s2;
    cin >> s1;
    cin >> s2;

    REP(i, s1.length()){
        if(s1.at(i) != s2.at(i)){
            cout << "No";
            cout << endl;
            return 0;
        } 
    }

    cout << "Yes";
    cout << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <bitset>

using namespace std;
typedef long long LL;
const int maxn = 200005;
const int mod = 1e9+7;

int a[maxn],n,bac[maxn];
bool check() {
	bool tag=((a[n]&1)+1==bac[a[1]]);
	for (int j=a[1]+1;j<=a[n];j++)
		tag&=bac[j]>=2;
	return tag;
}
int main()
{
	#ifdef Amberframe
		freopen("agc005c.in","r",stdin);
		freopen("agc005c.out","w",stdout);
	#endif
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]),bac[a[i]]++;
	sort(a+1,a+n+1);
	if (n==2) printf("%s",(a[1]==1&&a[2]==1)?"Possible":"Impossible");
	else printf("%s",check()?"Possible":"Impossible");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int x, y;
  int i, j;
  while(1){
    scanf("%d %d\n", &x, &y);
    if(x==0 && y==0)break;
    for(i=0; i<x; i++){
      for(j=0; j<y; j++){
        printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2536
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int P = sc.nextInt();
		int Q = sc.nextInt();
		int R = sc.nextInt();
		int tmp = Math.min(P+Q,Q+R);
		int ans = Math.min(tmp,R+P);
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
n = int(input())
s = [input() for i in range(n)]

a=s.count("AC")
w=s.count("WA")
t=s.count("TLE")
r=s.count("RE")

print("AC x " + str(a))
print("WA x " + str(w))
print("TLE x " + str(t))
print("RE x " + str(r))

Measured memory_bytes: 16300
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Vector;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		Submission array[] = new Submission[n];

		for(int i = 0; i < n; i++){
			int reply = Integer.parseInt(br.readLine());
			String message = br.readLine();

			Submission sub = new Submission(message);

			if(reply != 0){
				array[reply - 1].child.add(sub);
			}

			array[i] = sub;
		}

		printThread(array, array[0], 0);

	}

	static void printThread(Submission[] array, Submission sub, int depth){
		for(int i = 0; i < depth; i++){
			System.out.print('.');
		}
		System.out.println(sub.message);

		for(int i = 0; i < sub.child.size() ; i++){
			Submission tmp = sub.child.elementAt(i);

			printThread(array, tmp, depth + 1);
		}
	}

}

class Submission {
	Vector<Submission> child = new Vector<Submission>();
	String message;

	public Submission(String message) {
		this.message = message;
	}


}


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

int main()
{
  long long num;
  cin>>num;
  long long n=num%10;
  if(n==2 || n==4 || n==5 || n==7 || n==9)
    cout<<"hon"<<endl;
  else if(n==0 || n==1 || n==6 || n==8)
    cout<<"pon"<<endl;
  else
    cout<<"bon"<<endl;
}
  

Measured memory_bytes: 3640
import sys
N, Y = map(int,input().split())
sum_ = 0
for i in range(N+1):
  for j in range(N-i+1):
    sum_ = 10000*i + 5000*j + 1000*(N-i-j)
    if sum_ == Y:
      print(i,j,N-i-j)
      sys.exit()
print(-1,-1,-1)

Measured memory_bytes: 9188
#include<bits/stdc++.h>
    using namespace std;
     
    int main(){
     
    	int N,haba,kaku,iti;
     
    	cin>>N;
     
    	for(int i=0;i<N;i++){
    		cin>>haba>>kaku;
     
    		if(kaku % 30 == 0){
    		iti = 5*(kaku/30)+haba/100;
    		if(haba % 100 ==0) cout<<iti<<endl;
    		else cout<<iti<<" "<<iti+1<<endl;
    		}
     
    		else{
    		iti = 5*(kaku/30)+haba/100;
    		if(haba % 100 ==0) cout<<iti<<" "<<iti+5<<endl;
    		else cout<<iti<<" "<<iti+1<<" "<<iti+5<<" "<<iti+6<<endl;
    		}
     
     
    	}
     
    	return 0;
    }


Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include "unordered_map"
#include "map"
#include <cmath>
#include <climits>
#include "queue"
#include "tuple"
#include <algorithm>
#include <iomanip>
#include "sstream"
#include <math.h>

using ll=long long;
using ull=unsigned long long;
using ld=long double;
using namespace std;

//const double PI = M_PI;

template <typename T>
inline void printQueue(queue<T>&oq){queue<T>q(oq);int qCount=q.size();for(int i=0;i<qCount;++i){T qe=q.front();q.pop();
        cout<<qe;if(i!=qCount-1){cout << ", ";}q.push(qe);}cout << endl;}

template<typename T>
inline void PV(vector<T> v){int vc=v.size();for(int i=0;i<vc;++i){cout << v[i];if(i!=vc-1){cout<<", ";}}cout << endl;}

inline double round( double val )
{
    if( val < 0 ) return ceil(val - 0.5);
    return floor(val + 0.5);
}

int main() {
//    freopen("../input.txt","r",stdin);
//    freopen("../output.txt","w",stdout);
    ull n;
    cin >> n;
    int mnc = 0;
    int mxc = 0;
    int mc = 0;
    unordered_map<int, bool> cM;
    bool lr = false;
    for(int i = 0; i < n; ++i) {
        int r;
        cin >> r;
        int rc;
        if(r >= 1 && r <= 399) {
            lr = true;
            rc = 1;
        }
        if(r >= 400 && r <= 799) {
            lr = true;
            rc = 2;
        }
        if(r >= 800 && r <= 1199) {
            lr = true;
            rc = 3;
        }
        if(r >= 1200 && r <= 1599) {
            lr = true;
            rc = 4;
        }
        if(r >= 1600 && r <= 1999) {
            lr = true;
            rc = 5;
        }
        if(r >= 2000 && r <= 2399) {
            lr = true;
            rc = 6;
        }
        if(r >= 2400 && r <= 2799) {
            lr = true;
            rc = 7;
        }
        if(r >= 2800 && r <= 3199) {
            lr = true;
            rc = 8;
        }
        if(r >= 3200) {
            ++mc;
            continue;
        }
        if(!cM.count(rc)) {
            cM[rc] = true;
            ++mnc;
        }
    }
    if(mc > 0) {
        if(lr) {
            mxc = mnc + mc;
        }
        else {
            mnc = 1;
            mxc = mc;
        }
    }
    else {
        mxc = mnc;
    }
    cout << mnc << " " << mxc;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    //cout.precision(10);
    int maxi = 0;
    int mini = 100;
    int in;
    for(int i = 0; i < 3; i++){
        cin >> in;
        maxi = max(maxi, in);
        mini = min(mini, in);
    }
    cout << maxi - mini << endl;
    return 0;
}


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

public class Main {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static FastReader sc = new FastReader();
    static final double E = 0.000000001;
    static final long MOD = (long) (1e9 + 7);
    static final long MAX = (long)1e9 ;

    public static void main(String[] args) throws IOException {
        int n = sc.nextInt();
        System.out.println((double)((n+1)/2) / (double) n);
    }


}


Measured memory_bytes: 21460
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int q = scan.nextInt();

		int[] a = new int[n + 1];
		int i;
		for(i = 0; i < q; i++)
			a[scan.nextInt()]++;

		int border = q - k;
		for(i = 1; i <= n; i++) {
			if(a[i] > border) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		}
	}
}


Measured memory_bytes: 68688
// Author : MohamedSameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
void fo (){fflush(stdout);}
using namespace std;
int a[50000];
int n , q ;
int main ()
{int n;
scanf("%d",&n);
if(n<1200)
printf("ABC\n");
else
printf("ARC\n");
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int m, k;

int main(void)
{
	cin >> m >> k;
	if(k >= (1<<m)){
		cout << -1 << endl;
		return 0;
	}
	if(m == 0){
		cout << 0 << " " << 0 << endl;
		return 0;
	}
	if(m == 1){
		if(k == 0) cout << 0 << " " << 1 << " " << 1 << " " << 0 << endl;
		else cout << -1 << endl;
		return 0;
	}
	
	for(int i = (1<<m)-1; i >= 0; i--){
		if(i == k) continue;
		cout << i << " ";
	}
	cout << k << " ";
	for(int i = 0; i < (1<<m); i++){
		if(i == k) continue;
		cout << i << " ";
	}
	cout << k << endl;
	return 0;
}

Measured memory_bytes: 1792
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

a,b,c,k = iim()
if k < a:
    print(k)
elif k <= a+b:
    print(a)
else:
    print(a+(k-a-b)*(-1))

Measured memory_bytes: 9228
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(l: usize, r: usize);
    let start = l % 2019;
    let end = start + if r - l > 2019 { 2019 } else { r - l };

    let mut ar = Vec::new();
    for i in start..end + 1 {
        ar.push(i);
    }

    let mut ans_min = 1 << 20;
    for i in 0..ar.len() {
        for j in i + 1..ar.len() {
            let v = (ar[i] * ar[j]) % 2019;
            if v < ans_min {
                ans_min = v;
            }
        }
    }

    println!("{}", ans_min);
}


Measured memory_bytes: 2200
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

//union-find
#define UFLIMIT (1<<17)
int unicnt[UFLIMIT+10];//正ならcnt、非正なら根のindex
void ufinit(int n){rep(i,0,n)unicnt[i]=1;}
int ufroot(int x){return unicnt[x]<=0?-(unicnt[x]=-ufroot(-unicnt[x])):x;}
int ufsame(int x,int y){return ufroot(x)==ufroot(y);}
void uni(int x,int y){if((x=ufroot(x))==(y=ufroot(y)))return;if(unicnt[x]<unicnt[y]){int t=x;x=y;y=t;}unicnt[x]+=unicnt[y];unicnt[y]=-x;}
#undef UFLIMIT


//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g;}E;
typedef struct graph{
	int vcnt,ecnt;
	E  e[400010];//適宜変える(ecnt)
	int id[100010];//適宜変える(vcnt)
}G;
G g;

int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}
void readgraph(){
	//適宜変える
	ll n,m,k;
	scanf("%lld%lld%lld",&n,&m,&k);
	ufinit(n);
	int ecnt=0;
	rep(i,0,m){
		ll x,y;
		scanf("%lld%lld",&x,&y);
		x--,y--;
		uni(x,y);
		g.e[ecnt].s=x;
		g.e[ecnt].g=y;
		ecnt++;
		g.e[ecnt].s=y;
		g.e[ecnt].g=x;
		ecnt++;
	}
	rep(i,0,k){
		ll x,y;
		scanf("%lld%lld",&x,&y);
		x--,y--;
		g.e[ecnt].s=x;
		g.e[ecnt].g=y;
		ecnt++;
		g.e[ecnt].s=y;
		g.e[ecnt].g=x;
		ecnt++;
	}
	
	g.vcnt=n;
	g.ecnt=2*(m+k);
	qsort(g.e,g.ecnt,sizeof(E),esort);

	int p=0;
	rep(i,0,g.vcnt){
		while(p<g.ecnt&&g.e[p].s<i)p++;
		g.id[i]=p;
	}
	g.id[g.vcnt]=g.ecnt;//番兵
}

int main(){
	readgraph();
	rep(i,0,g.vcnt){
		int r=ufroot(i);
		int ans=unicnt[r];
		rep(j,g.id[i],g.id[i+1])if(ufroot(g.e[j].g)==r)ans--;
		printf("%d ",ans-1);
	}
}

Measured memory_bytes: 14412
N, X = [int(x) for x in input().split(' ')]
L = [int(x) for x in input().split(' ')]

D = [0]
for i, l in enumerate(L):
  D.append(D[i] + L[i])

i = 0
for d in D:
  if d <= X:
    i = i + 1
    
print(i)

Measured memory_bytes: 3060
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        d: i32
    }
    
    let ans = match d {
        25 => "Christmas",
        24 => "Christmas Eve",
        23 => "Christmas Eve Eve",
        22 => "Christmas Eve Eve Eve",
        _ => ""
    };
    
    println!("{}", ans);
}

Measured memory_bytes: 4352
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()

class Combination(): # nCr mod MOD など
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(10**6)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max) ##なくても問題ない
        self.fac, self.facinv = self.prepare(n_max)
    def prepare(self,n): # 前処理
        # 1! ~ n! の計算
        factorials = [1]  # 0!の分
        for m in range(1, n+1):
            factorials.append(factorials[m-1]*m%self.mod)
        # n!^-1 ~ 1!^-1 の計算
        invs = [1] * (n+1)
        invs[n] = pow(factorials[n], self.mod-2, self.mod)
        for m in range(n, 1, -1):
            invs[m-1] = invs[m]*m%self.mod
        return factorials, invs # list
    
    def make_modinv_list(self, n): # 0からnまでのmod逆元のリストを返す O(n)
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            # 整数aのMを法とした時の逆元a^-1は、(0<=a<=M-1)
            # a == qM+rであるとき(qは商,rは余り)、
            # a^-1 == -qr^-1 % M で与えられる。
            modinv[i] = (self.mod - self.mod//i)*modinv[self.mod%i]  % self.mod
        return modinv
        
    def combi_mod(self,n,r): # nCr % self.mod
        if n < r:
            return 0
        if (n < 0 or r < 0):
            return 0
        return (((self.fac[n] * self.facinv[r]) % self.mod) * self.facinv[n-r]) % self.mod

    def repeated_permutation(self,n,deno):
        # n!/(deno[0]!*deno[1]!*...*deno[len(deno)-1]) % MOD
        ## n:int(分子),deno:分母のlist
        if n < max(deno):
            return 0
        if (n < 0 or min(deno) < 0):
            return 0
        D = 1
        for i in range(len(deno)):
            D = D*self.facinv[deno[i]] % self.mod
        return self.fac*D % self.mod # int ## == n!/(deno[0]!*deno[1]!*...*deno[len(deno)-1]) % MOD
    
    def H(self,n,r): # 重複組合せ nHr % self.mod
        now_n = len(self.fac)
        if now_n < n+r-1: # もしself.facの長さが足りなかったら追加
            for i in range(now_n+1, n+r-1+1):
                self.fac.append(self.fac[i-1]*i%self.mod)
        return self.combi_mod(n+r-1,r)

C = Combination(N)
B = [-A[k]+A[N-k-1] for k in range(N-K+1)]
ans = 0
for i in range(N-K+1):
    ans += C.combi_mod(N-1-i,K-1)*B[i]
    ans %= 10**9+7
print(ans)




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

const int MaxN=1e5+5;

int N,Mx,Mn=1<<30,Cnt;
int A[MaxN];

int main(){
	int i;
	scanf("%d",&N);
	for(i=1;i<=N;i++){
		scanf("%d",&A[i]);
		Mx=max(Mx,A[i]);
		Mn=min(Mn,A[i]);
	}
	if(Mx>Mn+1){
		puts("No");
		return 0;
	}
	if(Mn^Mx){
		for(i=1;i<=N;i++)
			Cnt+=(A[i]<Mx);
		puts(Cnt>=Mx||2*(Mx-Cnt)>N-Cnt?"No":"Yes");
	}
	else puts(Mx==N-1||2*Mx<=N?"Yes":"No");
	return 0;
}

Measured memory_bytes: 640
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(n):
    a = []
    b = str(n)
    a.append(b)
    for i in a:
        c = i
    d = c[0]
    e = int(d)*100 + int(d)*10 + int(d)
    if e >= n:
        return e
    else:
        return int(e)+111

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    return int(line)

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h> 
 
using namespace std;
 
#define len(x) (int)((x).size())
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vi vector<int> 
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<int, int>
#define beg begin
 
#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 

template<class T> istream& operator>>(istream &str, vector<T> &a) {
	for (auto &i : a) {
		str >> i; 
	}
	return str;
}
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(10);
    solve();    
}

const int MAXN = 1e5 + 10;

struct bit {
	vi t;

	bit() {
		t.resize(MAXN);
	}

	int get(int i) {
		int res = 0;
		while (i >= 1) {
			res += t[i];
			i = (i & (i + 1)) - 1;
		}
		return res;
	}

	void upd(int i) {
		while (i < MAXN) {
			t[i]++;
			i = (i | (i + 1));
		}
	}
};

void solve() {
	int n, m;
	cin >> n >> m;
	vector<pair<int, int>> sg;
	for (int i = 0; i < m; ++i) {
		int u, v; cin >> u >> v;
		v--;
		sg.pb({v, u});
	}

	sort(all(sg));

	bit a;

	int ans = 0;
	for (auto it : sg) {
		int l = it.y, r = it.x;
		int sum = a.get(r) - a.get(l - 1);
		if (sum == 0) {
			ans++;
			a.upd(r);
		}	
	}

	cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    vector<ll> c(n,0);
    rep(i,n) {
        cin >> a.at(i);
        a.at(i)--;
        c.at(a.at(i))++;
    }
    ll total = 0;
    rep(i,n){
        if(c.at(i) >= 2) total += c.at(i) * (c.at(i) - 1) / 2;
    }
    rep(k,n){
        ll ans = total;
        int l = a.at(k);
        if(c.at(l) == 2) ans -= 1;
        else if(c.at(l) > 2){
            ans -= (c.at(l) - 1);
        }
        cout << ans << endl;
    }
    return 0;   
}

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;

    bool ans = false;
    For(i, 1, 9) {
        For(j, 1, 9) {
            if (i * j == n) {
                ans = true;
            }
        }
    }
    yn(ans);

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	long long n,a,b,sum,c;
	scanf("%lld %lld %lld",&n,&a,&b);
	c=n/(a+b);
	sum=c*a;
	n=n%(a+b);
	if(n<a)	sum+=n;
	else sum+=a;
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
#ABC134 B

import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7

n,d = map(int,input().split())
ans = math.ceil(n / (2*d + 1))
print(ans)


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

int main() {
  int h, w;
  cin >> h >> w;

  char map[h+1][w+1];
  for (int i = 0; i < h; i++) {
    for (int j = 0;  j < w; j++) {
      char c;
      cin >> c;
      map[i+1][j+1] = c;
    }
  }
  
  vector<vector<int>> left(h+2, vector<int>(w+2, 0));
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (map[i][j] == '#') { 
        left[i][j] = 0;
      } else {
        left[i][j] = left[i][j-1] + 1;
      }
      // printf("map[%d][%d] = %d\n", i, j, left[i][j]);
    }
  }

  vector<vector<int>> right(h+2, vector<int>(w+2, 0));
  for (int i = 1; i <= h; i++) {
    for (int j = w; j >= 1; j--) {
      if (map[i][j] == '#') { 
        right[i][j] = 0;
      } else {
        right[i][j] = right[i][j+1] + 1;
      }
      // printf("map[%d][%d] = %d\n", i, j, right[i][j]);
    }
  }

  vector<vector<int>> up(h+2, vector<int>(w+2, 0));
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (map[i][j] == '#') { 
        up[i][j] = 0;
      } else {
        up[i][j] = up[i-1][j] + 1;
      }
      // printf("up[%d][%d] = %d\n", i, j, up[i][j]);
    }
  }

  vector<vector<int>> down(h+2, vector<int>(w+2, 0));
  for (int i = h; i >= 1; i--) {
    for (int j = 1; j <= w; j++) {
      if (map[i][j] == '#') { 
        down[i][j] = 0;
      } else {
        down[i][j] = down[i+1][j] + 1;
      }
      // printf("down[%d][%d] = %d\n", i, j, down[i][j]);
    }
  }

  int res = 0;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      res = max(res, left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3);
    }
  }
  
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 67072
import sys

# 文字の読み込み
N = input()
N = int(N)

st = input().split()
H = [ int(x) for x in st]

# 見える数
# 最初の山は必ず海が見えるので，1からスタート
view = 1

# 一番高い山の高さを記憶
MH = H[0]

# 一番高い山と高さを比較
for i in range(1,N):
    if H[i] >= MH:
        view += 1
        MH = H[i]

print(view)

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

int main() {
	
	for (int i = 0; i < 5; i++) {
		int N;
		cin >> N;
		if (N == 0) {
			cout << i + 1 << endl;
			return(0);
		}
	}
	return(0);
}


Measured memory_bytes: 3588
#include <stdio.h>
int main(){
    int input;
    while(1){
        scanf("%d",&input);
        if(input==0)break;
        int cnt=0;
        while(input>1){
            if(input%2==0){
                input/=2;
            }else{
                input=input*3+1;
            }
            cnt++;
        }
        printf("%d\n",cnt);
    }
    return 0;
}

Measured memory_bytes: 600
import math

L, R = map(int, input().split())

ans = 2019

for i, j in zip(range(2019), range(L, R)):
    for k in range(j+1, min(L + 2019*2, R + 1)):
        lr_mod = (j * k) % 2019
        if lr_mod < ans:
            ans = lr_mod
        if ans==0:break
    if ans==0:break

print(ans)

Measured memory_bytes: 3060
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<string> s(N);
	for (int i = 0; i < N; ++i) {
		cin >> s[i];
	}
	bool ok = true;
	for (int i = 1; i < N; ++i) {
		for (int j = 0; j < i; ++j) {
			if (s[i] == s[j]) ok = false;
		}
		if (s[i - 1].back() != s[i].front()) ok = false;
	}
	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
j=[0]*n #当たり保管所
c=[0]*n #はずれ保管所
pe=0
ac=0
for i in range(m):
  p,s=input().split()
  p=int(p)-1
  if s[0]=="A" and j[p]==0:
    #正解かつ当たり保管所のp番目が0(まだ正解はない)なら
    j[p]=1#正解が入る
    ac+=1#出力の正解数+1
    pe+=c[p]#正解が入ったタイミングではずれ保管所に蓄積したWAを出力の不正解に追加
  elif s[0]=="W":c[p]+=1#もしはずれだったらはずれ判定所のp番目を+1する(はずれの蓄積)
print(ac,pe)

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

string s;
char c;
int cnt = 0;

int main () {
	cin >> s;
	for (int i = 0; i<4; i++){
		c = s[i];
		if(c ==43){
			cnt++;
		} else if (c ==45){
			cnt--;
		}
	}
	cout << cnt;
}

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

int main(){
	int a[33]={0,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
	int x;
	cin>>x;
	cout<<a[x];
	return 0;
}


Measured memory_bytes: 256
def merge(A,l,m,r):
    L=A[l:m];R=A[m:r]
    L.append(INF);R.append(INF)
    global cnt

    i=j=0    
    for k in range(l,r):
        cnt+=1
        if L[i]<=R[j]:
            A[k]=L[i]
            i+=1
        else:
            A[k]=R[j]
            j+=1        

def mergeSort(A,l,r):
    if l+1==r:
        pass
    else:
        m=(l+r)//2
        mergeSort(A,l,m)
        mergeSort(A,m,r)
        merge(A,l,m,r)

INF=10**9+1
n=int(input())
S=list(map(int,input().split()))
cnt=0

mergeSort(S,0,n)

for i in range(n):
    if i<n-1:
        print(S[i],end=' ')
    else:
        print(S[i])
print(cnt)


Measured memory_bytes: 61648