akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <cmath>
using namespace std;
long long gcd(long long a, long long b) {
	if (a < b) gcd(b, a);
	long long  r;
	while ((r = a%b)) {
		a = b;
		b = r;
	}
	return b;
}
long long lcm(long long a, long long b) {
	return a / gcd(a, b) * b;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

long long modinv(long long a, long long mod) {
	long long b = mod, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t*b; swap(a, b);
		u -= t*v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}
namespace NTT {
	const int MOD = 998244353;  // to be set appropriately
	const long long PR = 3;     // to be set appropriately

	void trans(vector<long long> &v, bool inv = false) {
		int n = (int)v.size();
		for (int i = 0, j = 1; j < n - 1; j++) {
			for (int k = n >> 1; k >(i ^= k); k >>= 1);
			if (i > j) swap(v[i], v[j]);
		}
		for (int t = 2; t <= n; t <<= 1) {
			long long bw = modpow(PR, (MOD - 1) / t, MOD);
			if (inv) bw = modinv(bw, MOD);
			for (int i = 0; i < n; i += t) {
				long long w = 1;
				for (int j = 0; j < t / 2; ++j) {
					int j1 = i + j, j2 = i + j + t / 2;
					long long c1 = v[j1], c2 = v[j2] * w % MOD;
					v[j1] = c1 + c2;
					v[j2] = c1 - c2 + MOD;
					while (v[j1] >= MOD) v[j1] -= MOD;
					while (v[j2] >= MOD) v[j2] -= MOD;
					w = w * bw % MOD;
				}
			}
		}
		if (inv) {
			long long inv_n = modinv(n, MOD);
			for (int i = 0; i < n; ++i) v[i] = v[i] * inv_n % MOD;
		}
	}

	// C is A*B
	vector<long long> mult(vector<long long> A, vector<long long> B) {
		int size_a = 1; while (size_a < A.size()) size_a <<= 1;
		int size_b = 1; while (size_b < B.size()) size_b <<= 1;
		int size_fft = max(size_a, size_b) << 1;

		vector<long long> cA(size_fft, 0), cB(size_fft, 0), cC(size_fft, 0);
		for (int i = 0; i < A.size(); ++i) cA[i] = A[i];
		for (int i = 0; i < B.size(); ++i) cB[i] = B[i];

		trans(cA); trans(cB);
		for (int i = 0; i < size_fft; ++i) cC[i] = cA[i] * cB[i] % MOD;
		trans(cC, true);

		vector<long long> res((int)A.size() + (int)B.size() - 1);
		for (int i = 0; i < res.size(); ++i) res[i] = cC[i];
		return res;
	}
};
typedef pair<int, int> p;
typedef pair<int, p> pai;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	if (a[0] == 5 && a[1] == 5 && a[2] == 7)cout << "YES";
	else cout << "NO";
}

Measured memory_bytes: 256
def main():
    buf = input()
    buflist = buf.split()
    A = int(buflist[0])
    B = int(buflist[1])
    board = []
    for i in range(100):
        board.append([])
        for j in range(100):
            if i < 50:
                board[-1].append('#')
            else:
                board[-1].append('.')
    A_remaining = A - 1
    for i in range(0, 50, 2):
        if A_remaining <= 0:
            break;
        for j in range(0, 100, 2):
            board[i][j] = '.'
            A_remaining -= 1
            if A_remaining <= 0:
                break;
    B_remaining = B - 1
    for i in range(100-1, 50-1, -2):
        if B_remaining <= 0:
            break;
        for j in range(0, 100, 2):
            board[i][j] = '#'
            B_remaining -= 1
            if B_remaining <= 0:
                break;
    print(100, 100)
    for i in range(100):
        print(''.join(board[i]))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3192
#include<stdio.h>
#define N 500000
#define S 1000000000
int L[N],R[N];
int count=0;
void merge(int A[],int left,int mid,int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int i,j,k;
  
  for(i=0;i<n1;i++) L[i] = A[left + i];
  for(i=0;i<n2;i++) R[i] = A[mid + i];
  L[n1] = 2*S;
  R[n2] = 2*S;
  i = 0;
  j = 0;
    for(k=left;k<right;k++){
      count++;
      if(L[i] <= R[j]){
	A[k] = L[i];
	i++;
      }
      else { 
	A[k] = R[j];
      j++;
      }
    }
}

void mergeSort(int A[],int left,int right){
  if (left+1 < right){
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main(){
  
  int A[N],n,i;

  scanf("%d",&n);

  for(i=0;i<n;i++) scanf("%d",&A[i]);
    mergeSort(A,0,n);
    
    for(i=0;i<n;i++){
      if(i == n-1)
	printf("%d\n",A[i]);
      else printf("%d ",A[i]);
    }

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

    return 0;
}



Measured memory_bytes: 5604
#include<stdio.h>
#define N 1000000

int a[N];
int cnt=0;
int G[N];
int m=0;

void insertionSort(int n,int g){
	for(int i=g;i<n;i++){
		int v=a[i];
		int j=i-g;
		while(j>=0 && a[j] > v){
			a[j+g]=a[j];
			cnt++;
			j=j-g;
		}
		a[j+g]=v;
	}
	return;
}


void shellSort(int n){
	int temp=n;
	
	if(n==1){
		G[m++]=1;
	}
	else {
	
		while(temp/2!=0){
			G[m++]=temp/2;
			temp/=2;
		}
	}
	
	for(int i=0;i<m;i++)
		insertionSort(n,G[i]);
	
	return;
}



int main(){
	int n,i;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	
	shellSort(n);
	
	
	printf("%d\n",m);
	for(i=0;i<m-1;i++)
		printf("%d ",G[i]);
	printf("%d\n",G[m-1]);
	
	printf("%d\n",cnt);
	
	for(i=0;i<n;i++)
		printf("%d\n",a[i]);
	
	return 0;
	
}


Measured memory_bytes: 5640
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author HARSHAD
 */

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

class TaskC {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n; in>>n;
		vector<pair<int, int>> arr;
		for(int i = 0; i<n; ++i){
		    int x; in>>x;
			arr.emplace_back(x, i);
		}
		sort(arr.begin(), arr.end());
		vector<int> res(n);
		int a = arr[n/2].first, b = arr[n/2-1].first;
		for(int i = 0; i<n; ++i){
			if(i<n/2) res[arr[i].second] = a;
			else res[arr[i].second] = b;
		}
		for(int x: res) out<<x<<"\n";
	}
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	TaskC solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

#define ll long long
#define pb push_back

int main()
{
	string a, b;
	cin >> a >> b;
	
	int c=0;
	
	for(int i=0;i<3;i++)
	{
		if(a[i]==b[i]) c++;
	}
	
	cout << c << endl;
 
	return 0;
}

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

using namespace std;
using ll = long long;

int main(){
  int N, K;
  cin >> N >> K;
  
  double p = 0;
  
  for(int i=1; i<=N; i++){
    double tmp = 1.0/N;
    
    int now = i;
    while(now<K){
      now *= 2;
      tmp /= 2;
    }
    
    p += tmp;
  
  }
  
  //cout << p << endl;
  printf("%.12lf\n", p);
  return 0;
}

Measured memory_bytes: 3652
from heapq import heappop, heappush
from itertools import permutations


def solve(links, rs):
    r = len(rs)
    dists = [[-1] * r for _ in range(r)]
    r_dict = {ri: i for i, ri in enumerate(rs)}
    for ri in rs:
        dists_r = dists[r_dict[ri]]
        visited = set()
        queue = [(0, ri)]
        r_cnt = 0
        while queue:
            cost, node = heappop(queue)
            if node in visited:
                continue
            if node in r_dict:
                dists_r[r_dict[node]] = cost
                r_cnt += 1
                if r_cnt == r:
                    break
            visited.add(node)
            for c, a in links[node]:
                if a not in visited:
                    heappush(queue, (cost + c, a))
    ans = 1e9
    for p in permutations(range(r)):
        tmp = sum(dists[r1][r2] for r1, r2 in zip(p, p[1:]))
        ans = min(ans, tmp)
    return ans


n, m, r = map(int, input().split())
rs = [i - 1 for i in map(int, input().split())]
links = [set() for _ in range(n)]
for a, b, c in (map(int, input().split()) for _ in range(m)):
    a -= 1
    b -= 1
    links[a].add((c, b))
    links[b].add((c, a))

print(solve(links, rs))


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

int main() {
  int a = 0;
  int index = 0;
  vector<int> ans(3, 0);
  cin >> a;

  for ( int i = 0; i < 3; i++ ){
    index = a % 10;
    if ( index == 1 ){
      ans[i] = 9;
    }
    else if ( index == 9 ){
      ans[i] = 1;
    }
    else{
      ans[i] = index;
    }

    a /= 10;
  }

  cout << ans[2] << ans[1] << ans[0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int a,b;
    cin >> a >> b;
    for(int i=0;i<=100000;i++){
        if(i*8/100==a && i/10 == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
/*
 _  __    _   _   _ ____ _____ 
| |/ /   / \ | | | / ___|_   _|
| ' /   / _ \| | | \___ \ | |  
| . \  / ___ \ |_| |___) || |  
|_|\_\/_/   \_\___/|____/ |_|  
*/
#include <bits/stdc++.h>
#include <fstream>
#define rep(i, a, b) for (long long i = (a); i < (b); i++)
#define per(i, a, b) for (long long i = (a); i > (b); i--)
#define a(x) (x.begin(), x.end())
#define ar(x) (x.rbegin(), x.rend())
#define pb push_back
#define Pb() pop_back()
#define ll long long int
#define ull unsigned long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sc scanf
#define scin(x) sc("%d", &(x))
#define scln(x) sc("%lld", &(x))
#define pf prllf
#define ms(a, b) memset(a, b, sizeof(a))
#define mp make_pair
#define db double
#define EPS 10E-10
#define ff first
#define ss second
#define sqr(x) (x) * (x)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<ll>>
#define DBG pf("HI\n")
#define MOD 1000000007
#define CIN                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define RUN_CASE(t, T) for (__typeof(t) t = 1; t <= T; t++)
#define CASE(t) prllf("Case %d: ", t)
#define CASEL(t) prllf("Case %d:\n", t)
#define intlimit 2147483647
#define longlimit 9223372036854775807
#define infinity (1 << 28)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
#define PI 2 * acos(0.0)
using namespace std;
int main()
{
    CIN;
    int n, k;
    cin >> n >> k;
    vi v(n);
    rep(i, 0, n)
    {
        cin >> v[i];
    }
    int dp[n];
    rep(i, 0, n)
    {
        dp[i] = intlimit;
    }
    dp[0] = 0;
    rep(i, 0, n)
    {
        rep(j, 1, k + 1)
        {
            if (i < n - j)
                dp[i + j] = min(dp[i + j], dp[i] + abs(v[i] - v[i + j]));
        }
    }
    cout << dp[n - 1];
}


Measured memory_bytes: 1024
#ABC 81, B - shift only
import itertools

n = int(input())
A = [int(el) for el in input().split(' ')]
count = 0
for i in itertools.count(0):
    if all([a % 2 == 0 for a in A]):
        A = [a / 2 for a in A]
        count += 1
    else:
        break
print(count)


Measured memory_bytes: 3060
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>

int main() {
  int n, k;
  std::cin >> n >> k;
  std::vector<int> p(n);
  for (int &e : p)
    std::cin >> e;
  int ans = 0;
  int acc = 0;
  for (int i = 0; i != n; i += 1) {
    acc += p[i];
    if (i >= k)
      acc -= p[i - k];
    ans = std::max(ans, acc);
  }
  std::cout << std::setprecision(10) << static_cast<double>(ans + k) / 2
            << std::endl;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int a,b;

	cin>>a>>b;

	if(a==1){
		a=14;
	}
	if(b==1){
		b=14;
	}

	if(a<b){
		cout<<"Bob"<<endl;
	}
	if(a>b){
		cout<<"Alice"<<endl;
	}
	if(a==b){
		cout<<"Draw"<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define eb emplace_back
#define pb push_back
#define ll unsigned long long
#define mp make_pair
#define x first
#define y second
#define mod 1000000007
#define min(a,b) a<b?a:b
#define max(a,b) a>b?a:b
#define sc(a) scanf("%d",&a);
using namespace std;
int main()
{
    int n;int a[205];
    cin >> n;
    n*=2;
    int i;
    rep(i,0,n){
        cin >> a[i];
    }
    sort(a,a+n);
    int s=0;
    for(i=0;i<n;i=i+2)
    {
        s+=a[i];
    }
    cout << s << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void back(vector<vector<int>> &vec,int j,vector<int> temp,int X,int &ans)
{
    if(j>=vec.size())
        return;
    int flag=1;
   
    back(vec,j+1,temp,X,ans);
    for(int i=0;i<vec[0].size();i++)
    {
             temp[i]=temp[i]+vec[j][i];
    }   
     for(int i=1;i<temp.size();i++)
    {
        if(temp[i]>=X)
        {
           continue;
        }
         else{
             flag=0;
             break;
         }
    }
    if(flag)
    {
        ans=min(temp[0],ans);
        return;
    }
    back(vec,j+1,temp,X,ans);
}
int main()
{
    int n,m,X;
    cin>>n>>m>>X;
    vector<vector<int>> vec(n,vector<int> (m+1));
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<=m;j++)
            cin>>vec[i][j];
    }
    vector<int> temp(m+1);
    int sum=0;
    int ans=INT_MAX;
    back(vec,0,temp,X,ans);
    if(ans==INT_MAX)
        cout<<"-1";
    else
        cout<<ans;
    return 0;
}

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

int main(void){
    int millennium=196470;
    int birthday=0;
    int n=0;
    int y,m,d=0;

    cin >> n;
    if(n<1||100<n)
        return 0;
    int ans[n+1];
    for(int i=0;i<n;i++){
        cin >> y >> m >> d;
        if(y<1||1000<y)
            return 0;
        if(m<1||11<m)
            return 0;
        if(d<1||21<d)
            return 0;
        birthday=0;
        birthday+=(y-1)/3*590;
        birthday+=(y-1)%3*195;
        if(y%3!=0){
            birthday+=(m-1)/2*39;
            birthday+=(m-1)%2*20;
        }
        else if(y%3==0){
            birthday+=(m-1)*20;
        }
        birthday+=(d-1);
        ans[i]=millennium-birthday;
    }
    for(int i=0;i<n;i++){
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3068
#include<bits/stdc++.h>
#define int long long
#define N 500005
using namespace std;
int n,ans;
struct node{int x,y;}a[N];
inline bool cmp(node aa,node bb){return aa.x>bb.x;}
signed main(){
	scanf("%lld",&n);
	for (int i=1;i<=n;i++) scanf("%lld%lld",&a[i].x,&a[i].y),ans-=a[i].y,a[i].x+=a[i].y;
	sort(a+1,a+n+1,cmp);
	for (int i=1;i<=n;i+=2) ans=ans+a[i].x;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#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 = 5000100;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll dx[8] = { 0,0,-1,1 };
ll dy[8] = { -1,1,0,0 };
ll dp[101010];

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

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

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

bool graph[101][101];
bool visit[101010];
vector<ll> to[101010];
vector<ll>ball(101010, 1);
vector<bool>flag(101010);

//long longしか使わない
//素数は1より大きい
int main() {
	ll n, c, k;
	cin >> n >> c >> k;
	vector<ll>t(n);
	rep(i, n) {
		cin >> t[i];
	}
	sort(t.begin(), t.end());
	ll res = 0;
	ll ans = 0;
	ll target = t[0] + k;
	rep(i, n) {
		if (target >= t[i])res++;
		else {
			ans++;
			res = 1;
			target = t[i] + k;
		}
		if (res == c) {
			ans++;
			res=0;
			if (i != n - 1) {
				target = t[i + 1] + k;
			}
		}
	}
	if (res != 0)ans++;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5888
a=int(input())
b=list(map(int,input().split()))
c=[int(input()) for _ in range(a)]
ans=0
for i in range(a):
    ans+=b[0]//int(c[i])+1
for k in range(a):
    if c[k]==1 or b[0]%int(c[k])==0:
        ans-=1
print(ans+b[1])

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

#ifdef _DEBUG
#define dout cout
#define debug() if (true)
#define dvout(v) vout(v)
#else
#define dout if (false) cout
#define debug() if (false)
#define dvout(v) if(false) vout(v)
#endif

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define vout(v)           \
	for (auto &i : v)     \
	{                     \
		cout << i << " "; \
	}                     \
	cout << "\n"; //配列出力
#define vec(v, n) vector<int> v(n, 0);
#define vecll(v, n) vector<ll> v(n, 0);
#define vecvec(v,n,m) vector<vector<int>> v(n, vector<int>(m));
#define vin(v)        \
	for (auto &i : v) \
		cin >> i; //配列入力

#define mod (int)(1e9+7)
typedef long long ll;
typedef unsigned long long ull;
#define next asdnext
#define prev asdprev
#define _n "\n"
#define _n2 "\n\n"
#define _t "\t"

//	LLONG_MAX 9.2*1e18
//	O(1e7) O(1e8)

void Main()
{
	int N;
	cin>>N;
	if(N>=30)cout<<"Yes"<<_n;
	else cout<<"No"<<_n;
}


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


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class segtree{
public:
	static const int N=1<<17;
	int dp[1<<18];
	segtree(){
		memset(dp,0,sizeof(dp));
	}
	void update(int k,int v){
		k+=N-1;
		dp[k]=v;
		while(k>0){
			k=(k-1)/2;
			dp[k]=min(dp[k*2+1],dp[k*2+2]);
		}
	}

	int query(int a,int b,int k=0,int l=0,int r=N){
		if(b<=l || r<=a)return 114514;
		if(a<=l && r<=b)return dp[k];
		int mid=(l+r)/2;
		int vl=query(a,b,k*2+1,l,mid);
		int vr=query(a,b,k*2+2,mid,r);
		return min(vl,vr);
	}
};

int n;
int a[100005];
int cnt[100005];
int ans[100005];
int ord[100005];
set<int> se[100005];
segtree seg;

void solve2(){
	for(int i=0;i<n;i++){
		ord[i]=i;
		ans[i]=n;
	}
	do{
		bool flag=true;
		for(int i=0;i+1<n;i++){
			if(a[ord[i]]==ord[i+1]){
				flag=false;
				//printf("%d %d %d\n",i,a[ord[i]],ord[i+1]);
			}
		}
		//printf("%d %d %d %d %c\n",ord[0],ord[1],ord[2],ord[3],flag?'y':'n');
		if(flag){
			int fl=0;
			for(int i=0;i<n;i++){
				if(ord[i]<ans[i]){
					fl=1;
					break;
				}
				if(ord[i]>ans[i]){
					fl=-1;
					break;
				}
			}
			//printf("%d\n",fl);
			if(fl==1){
				for(int i=0;i<n;i++){
					ans[i]=ord[i];
				}
			}
		}
	}while(next_permutation(ord,ord+n));
}

bool used[100005];

void solve3(){
	vector<int> vec;
	for(int i=0;i<n;i++){
		if(!used[i]){
			vec.push_back(i);
		}
	} 
	for(int i=0;i<5;i++){
		ord[i]=vec[i];
	}
	for(int i=n-5;i<n;i++){
		ans[i]=n;
	}
	do{
		bool flag=true;
		if(a[ans[n-6]]==ord[0]){
			flag=false;
		}
		for(int i=0;i<5;i++){
			if(a[ord[i]]==ord[i+1]){
				flag=false;
			}
		}
		if(flag){
			int fl=0;
			for(int i=n-5;i<n;i++){
				if(ord[i-(n-5)]<ans[i]){
					fl=1;
					break;
				}
				if(ord[i-(n-5)]>ans[i]){
					fl=-1;
					break;
				}
			}
			if(fl==1){
				for(int i=n-5;i<n;i++){
					ans[i]=ord[i-(n-5)];
				}
			}
		}
	}while(next_permutation(ord,ord+5));
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		a[i]--;
		cnt[a[i]]++;
	}
	if(n==2){
		printf("-1\n");
		return 0;
	}
	if(n<=10){
		solve2();
	}else{
		for(int i=0;i<n;i++){
			se[cnt[i]].insert(i);
			seg.update(i,i);
		}
		int sz=n-1;
		for(int i=0;i<n-5;i++){
			int res=0;
			if(se[sz].size()>0){
				set<int>::iterator it=se[sz].begin();
				res=(*it);
			}else{
				int val=seg.query(0,n);
				//if(i>0)printf("%d %d\n",val,a[ans[i-1]]);
				if(i>0 && a[ans[i-1]]==val){
					val=seg.query(val+1,n);
				}
				res=val;
			}
			//printf("%d\n",res);
			se[cnt[res]].erase(res);
			sz--;
			se[cnt[a[res]]].erase(a[res]);
			cnt[a[res]]--;
			se[cnt[a[res]]].insert(a[res]);
			seg.update(res,114514);
			used[res]=true;
			ans[i]=res;
		}
		solve3();
	}
	for(int i=0;i<n;i++){
		printf("%d%c",ans[i]+1,i+1==n?'\n':' ');
	}
	return 0;
}


Measured memory_bytes: 12800
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N, M, X = LI()
A = LI()

left = 0
right = 0

cs = [0 for i in range(N)]
for a in A:
    cs[a] = 1
for i in range(X):
    if cs[i]:
        left += 1

for i in range(X, N):
    if cs[i]:
        right += 1

print(min(left, right))

Measured memory_bytes: 10648
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<class T>ostream& operator<<(ostream& o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
V<ll>fac,rfac;void setFac(int n,int mod){fac=rfac=V<ll>(++n);fac[0]=1;FOR(i,1,n)fac[i]=fac[i-1]*i%mod;rfac[n-1]=modInv(fac[n-1],mod);FORR(i,n-1,1)rfac[i-1]=rfac[i]*i%mod;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 3e3+100;
ll n, f[N], ans[N];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  setFac(n-1, n);
  f[0] = 1;
  FOR(i, 0, n){
    FORR(j, i, 0) f[j+1] = (f[j+1]*-i+f[j])%n;
    (f[0]*=-i)%=n;
  }
  FOR(i, 0, n){
    ll a;
    cin >> a;
    if(a) FORR(j, n-1, 0) ans[j]+=a, a=(f[j]+a*i)%n;
  }
  ll r = modInv(n-1, n);
  FOR(i, 0, n) cout << (ans[i]*r%n+n)%n << (i<n-1 ? ' ' : '\n');
}

Measured memory_bytes: 384
n = int(input())
A = list(map(int, input().split()))
setA = set(A)
listSetA = list(setA)

if A == [0 for i in range(n)]:
    print("Yes")
elif len(setA) == 2 and listSetA[0] == 0 and 2*A.count(0) == A.count(listSetA[1]):
    print("Yes")
elif len(setA) == 3 and listSetA[0] ^ listSetA[1] == listSetA[2] and A.count(listSetA[0]) == A.count(listSetA[1]) == A.count(listSetA[2]):
    print("Yes")
else:
    print("No")


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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

int gcd(int x, int y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int n;
	cin >> n;
	cout << n / 3 << "\n";
}

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


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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)

int n;

const char mes[3] = {'A', 'B', 'C'};

void solve() {
  rep(i,n) {
    int pm, pe, pj; cin>>pm>>pe>>pj;
    double avg = (pm+pe+pj)/3.0;
    int res;
    if (pm == 100 || pe == 100 || pj == 100) {
      res = 0;
    } else if ((pm+pe)/2.0 >= 90.0) {
      res = 0;
    } else if (avg >= 80.0) {
      res = 0;
    } else if (avg >= 70.0) {
      res = 1;
    } else if (avg >= 50.0 && (pm >= 80 || pe >= 80)) {
      res = 1;
    } else {
      res = 2;
    }
    cout<<mes[res]<<endl;
  }
}

int main (int argc, char const* argv[]) {
  while (cin>>n, n) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
using namespace std;
int main(){
	string S1,S2,S3,X;
	cin >> S1 >> S2 >> S3;
	S1[0] -= 32;
	S2[0] -= 32;
	S3[0] -= 32;
	cout << S1[0] << S2[0] << S3[0];
}

Measured memory_bytes: 888
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int n = 0;
        
        if(a < b){
            n = a;
            a = b;
            b = n;
        }
        if(a < c){
            n = a;
            a = c;
            c = n;
        }
        if(b < c){
            n = b;
            b = c;
            c = n;
        }
        System.out.println(c + " " + b + " " + a);
    }
}


Measured memory_bytes: 26236
#include<bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define mp map<int,int>
#define pp make_pair
#define endl "\n"
#define vi vector<int>
#define vbl vector<bool>
#define pii pair<int,int>
#define ll long long 
#define clock high_resolution_clock::now()

// auto duration = duration_cast<microseconds>(stop - start);  cout<<duration.count();

const int INF = 1e9+5;
const int mod = 1e9 + 7;

using namespace std;
using namespace std::chrono;

int main(){
     int n;
     cin>>n;
     map<pii, int>cnt;
     for(int rep=0; rep<n; rep++){
          double x;
          cin>>x;
          ll i = llround(x * 1e9);
          int two= 0, five = 0;
          while(i%2==0){
               two++;
               i/=2;
          }
          while(i%5==0){
               five++;
               i/=5;
          }
          ++cnt[{two, five}];
     }
     ll ans = 0;
     for(auto p1 : cnt){
          for(auto p2 : cnt){
               if(p1.first.first + p2.first.first>=18 && p1.first.second + p2.first.second>=18){
                    if(p1<p2)ans+=(ll)p1.second * p2.second;
                    else if(p1==p2)ans+=(ll)p1.second * (p1.second-1)/2;
               }
          }
     }
     cout<<ans<<endl;
                    

	return 0;
}
	
	

Measured memory_bytes: 3736
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
#include <cmath>
#include <vector>
#include <string>

#define REP(i, n) for (int i=0;i<(n);i++)
#define FOR(i, a, b) for (int i=(a);i<(b);i++)

using namespace std;

int n;
int a[100001];

int main()
{
    scanf("%d", &n);
    REP(i, n)
        scanf(" %d", &a[i]);

    int a_max = 0;
    REP(i, n)
        a_max = max(a_max, a[i]);

    int r_max = 0;
    bool bigger = false;
    REP(i, n) {
        if(a[i]<=a_max/2) {
            if(r_max<a[i]) {
                r_max = a[i];
                bigger = false;
            }
        } else {
            if(r_max<a_max-a[i]) {
                r_max = a_max-a[i];
                bigger = true;
            }
        }
    }

    printf("%d %d\n", a_max, bigger ? a_max-r_max : r_max);

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
// #define int long long
#define first first
#define second se
using namespace std;
typedef pair<int, int> P;
typedef vector<int> vi;

signed main(){
    int n;
    string s, t;
    cin >> n >> s >> t;
    int l = min(s.size(), t.size());
    int c = 0;
    rep(i, 0, l + 1){
        bool f = true;
        rep(j, 0, i){
            if(t[j] != s[s.size() - i + j]){
                f = false;
            }
        }
        if(f) c = max(c, i);
    }
    int ans = max(n, (int)s.size() + (int)t.size() - c);
    o(ans);
}

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

void solve(){
    string s;
    cin >> s;
    if(s.back() != 's')
        s += 's';
    else 
        s += "es";
    cout << s << "\n";
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t =1;
    while(t--)
        solve();
    return 0;
}



Measured memory_bytes: 3652
import sys
input = sys.stdin.readline
def main():
    H, N = map( int, input().split())
    AB = [ list( map( int, input().split())) for _ in range(N)]
    dp = [10**9]*H + [0]*(10**4+1)
    T = H+10**4
    for a, b in AB:
        for i in range(T,a-1,-1):
            if dp[i-a] > dp[i]+b:
                dp[i-a] = dp[i]+b
    print(dp[0])
if __name__ == '__main__':
    main()


Measured memory_bytes: 41200
n,pr = gets.split.map(&:to_i)
s = gets.chomp

ans = 0
if pr==2 || pr==5
  n.times{|i|
    ans += i+1 if s[i].to_i%pr==0
  }
else
  map = Hash.new(0)
  map[0] = 1
  s.reverse!
  ketam = 1
  prevm = 0
  n.times{|i|
    t = (ketam * s[i].to_i + prevm) % pr
    ans += map[t]
    map[t] += 1
    ketam = ketam*10%pr
    prevm = t
  }
end
p ans


Measured memory_bytes: 2812
N = input()
if N[-1] == '2' or N[-1] == '4' or N[-1] == '5' or N[-1] == '7' or N[-1] == '9' :
  print('hon')
elif N[-1] == '0' or N[-1] == '1' or N[-1] == '6' or N[-1] == '8' :
  print('pon')
else:
  print('bon')

Measured memory_bytes: 9120
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
using namespace std;
#define INT_MAX 2147483647
#define INT_MIN (-2147483647 - 1)
#define INF (int)1e8
#define _INF (int)-1e8
#define INFLL (long long)1e14
#define _INFLL (long long)-1e14
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;

class Graph {
private:
	struct node {
		bool done;
		vi to, cost;
		int id, from;
		ll d;
		bool operator<(const node & another) const {
			return !(d != another.d ? d < another.d : id < another.id);
		}
	};
	vector<node> nodes;
	int n;
public:
	vll result;
	Graph(vector<vector<P>> data) {
		n = data.size();
		result.resize(n);
		nodes.resize(n);
		Loop(i, n) {
			nodes[i] = { false,{},{}, i, -1, INFLL };
			Loop(j, data[i].size()) {
				nodes[i].to.push_back(data[i][j].first);
				nodes[i].cost.push_back(data[i][j].second);
			}
		}
	}
	void reset() {
		Loop(i, n) {
			nodes[i].done = false;
			nodes[i].from = -1;
			nodes[i].d = INFLL;
		}
		fill(result.begin(), result.end(), 0);
	}
	//mode=>dijkstra, !mode=>prim
	void mainalgo(int start, int mode) {
		reset();
		priority_queue<node> pq;
		nodes[start].d = 0;
		pq.push(nodes[start]);
		while (pq.size()) {
			node a = pq.top(); pq.pop();
			if (nodes[a.id].done) continue;
			nodes[a.id].done = true;
			Loop(j, a.to.size()) {
				node *b = &nodes[a.to[j]];
				if ((*b).done) continue;
				ll cand = (mode ? a.d : 0) + a.cost[j];
				if (cand < (*b).d) {
					(*b).d = cand;
					(*b).from = a.id;
					pq.push(*b);
				}
			}
		}
		Loop(i, n) result[i] = nodes[i].d;
	}
	bool bellman_ford(int start) {
		reset();
		nodes[start].d = 0;
		Loop(k, n) {
			Loop(i, n) {
				node *a = &nodes[i];
				Loop(j, (*a).to.size()) {
					node *b = &nodes[(*a).to[j]];
					if ((*a).d != INFLL && (*a).d + (*a).cost[j] < (*b).d) {
						(*b).d = (*a).d + (*a).cost[j];
						(*b).from = (*a).id;
						if (k == n - 1) return false;
					}
				}
			}
		}
		Loop(i, n) result[i] = nodes[i].d;
		return true;
	}
};

int main() {
	int n, m, r; cin >> n >> m >> r;
	vector<vector<P>> data(n);
	Loop(i, m) {
		int s, t, d; cin >> s >> t >> d;
		data[s].push_back({ t,d });
	}
	Graph g(data);
	if (g.bellman_ford(r)) {
		Loop(i, n) {
			if (g.result[i] == INFLL) cout << "INF" << endl;
			else cout << g.result[i] << endl;
		}
	}
	else cout << "NEGATIVE CYCLE" << endl;
	return 0;
}

Measured memory_bytes: 3344
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res *= a; if(mod>=1) res %= mod;
        }
        a *= a; if(mod>=1) a %= mod;
        n >>= 1;
    }
    return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int a[LIMIT2]={0};
  char s[LIMIT1];
  
  scanf("%lld",&n);
  scanf("%lld",&m);
  result = 6-n-m;
  printf("%lld", result);
  
  return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

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

    int ans = 0;
    rep(i, n)
    {
        if (s.substr(i, 3) == "ABC")
        {
            ans++;
        }
    }

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


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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
   int n, x, t;
   cin >> n >> x >> t;
   int ans = 0;
   int sum1=0, sum2=0;
   while(true){
       sum1 += t;
       sum2 += x;
       if(n<=sum2){
           cout << sum1 << endl;
           return 0;
       }
   }
}

Measured memory_bytes: 3620
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define UP(i,a,b) for(int i=(a); i<=(b); ++i)
#define DOWN(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) UP(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //NOTE: <a> must be sorted in advance

lng power(lng b, int n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7
const double PI = 3.1415926535897932384626;

/*********** variables ************/
lng H, W;
/**********************************/

lng max3(lng a, lng b, lng c) {
    return max(a,max(b,c));
}

lng min3(lng a, lng b, lng c) {
    return min(a,min(b,c));
}

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

    lng ans = 1LL<<62;
    REP(turn, 2) {
        swap(H, W);
        UP(h, 1, H-1) {
            lng s1 = W * (H - h);
            lng s2 = h*(W/2);
            lng s3 = h*((W+1)/2);
            ans = min(ans, max3(s1,s2,s3) - min3(s1,s2,s3));
        }
        ans = min(ans, W*((H+2)/3) - W*(H/3));
    }
    cout << ans << endl;
}

//prototype
// #define int long long
// signed main() {
//     cin.tie(0);
//     ios::sync_with_stdio(false);
//     cin>>H>>W;
//
//     int ans = MOD;
//     UP(h, 1, H-1) {
//         int s1 = W*(H-h);
//         int s2 = (W/2)*h;
//         int s3 = ((W+1)/2)*h;
//         int big = max(s1,max(s2,s3));
//         int small = min(s1,min(s2,s3));
//         ans = min(ans, big-small);
//     }
//     UP(w, 1, W-1) {
//         int s1 = H*(W-w);
//         int s2 = (H/2)*w;
//         int s3 = ((H+1)/2)*w;
//         int big = max(s1,max(s2,s3));
//         int small = min(s1,min(s2,s3));
//         ans = min(ans, big-small);
//     }
//     int t1 = H*(W/3);
//     int t2 = H*((W+2)/3);
//     ans = min(ans, t2-t1);
//     int v1 = W*(H/3);
//     int v2 = W*((H+2)/3);
//     ans = min(ans, v2-v1);
//     cout << ans << endl;
// }


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int x = 0;
    for(int i = 0 ; i < s.length() ; i++ ) {
        if( s[i] == 'g' ) x++;
        else x--;
    }
    cout << x / 2;
}



Measured memory_bytes: 512
from sys import stdin, stdout
from collections import defaultdict
def readLine_int_list():return list(map(int, stdin.readline().split()))
def readLine_int_list_reverse(): return list(map(int, stdin.readline().split())).reverse()
def readAll_int(): return list(map(int, stdin))
def readLine_str_list():return list(map(str, stdin.readline().split()))
def readAll_str(): return list(map(str, stdin))

import re

def main():
	_s = input()
	t = input()
	pattern=""
	for i in t:
	    pattern += "[?{}]".format(i)
	l=[]
	ans = ""
	f = False
	ff = False
	for i in range(len(_s)):
	    if _s[i] == '?' or _s[i] == t[0]:
	        tmp = _s[i:i+len(t)]
	        match = re.match(pattern , tmp)
	        if match:
	            f = True
	            if _s[i] == t:
	                ans += _s[i]
	                ff = True
	            else:
	                ans += 'X'
	        else:
	            ans += 'a'
	    else:
	        ans += _s[i]
	    
# 	print(ans)
	for i in range(len(ans)):
	    if ans[i] == "X":
	       _ans = [_ for _ in ans]
	       
	       if ff:
	           l.append(''.join(_ans).replace("X","a"))
	       else:
	           _ans[i:i+len(t)] = t
	           for i in range(len(_ans)):
	               if _s[i] != '?':
	                   _ans[i] = _s[i]
	           l.append(''.join(_ans).replace("X","a"))
	       
	if f:
	    ans = ''.join(min(l))
	    print(ans)
	else:
	    print("UNRESTORABLE")
	    
if __name__ == "__main__":
    main()


Measured memory_bytes: 3564
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <cmath>


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


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

int main() {
	int a, b;

	cin >> a >> b;

	if (b == 1) {
		cout << 0 << endl;
		return 0;
	}

	rep(i, 1, 21) {
		if ((a +(a-1) * (i-1)) >= b) {
			cout << i << endl;
			break;
		}
	}


	return 0;
}



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

int main() {
    int D;cin>>D;
    if(D==25)
    cout<<"Christmas"<<endl;
    else if(D==24)
    cout<<"Christmas"<<" "<<"Eve"<<endl;
    else if(D==23)
    cout<<"Christmas"<<" "<< "Eve"<<" "<< "Eve"<<endl;
    else 
    cout<<"Christmas"<< " "<<"Eve"<< " "<<"Eve"<<" "<< "Eve"<<endl;
}
   

Measured memory_bytes: 256
/*

*/
#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  //逶ｮ讓吶・鬟幄ｷ晞屬繧・K 縺ｮ蛟肴焚縺ｫ縺吶ｋ縺薙→
  //繧ｸ繝｣繝ｳ繝憺ｫ俶ｩ句菅縺ｮ蜃ｺ縺帙ｋ鬟幄ｷ晞屬縺ｮ遽・峇縺ｯ A 莉･荳・B 莉･荳・
  double k,a,b;cin>>k>>a>>b;

  //逶ｮ讓吶・驕疲・縺悟庄閭ｽ縺ｧ縺ゅｌ縺ｰ OK 縺ｨ縲・
  //荳榊庄閭ｽ縺ｧ縺ゅｌ縺ｰ NG 縺ｨ蜃ｺ蜉帙＠縺ｦ縺上□縺輔＞縲・
  cout<<(k*ceil(a/k)<=b ? "OK":"NG")<<endl;
}


Measured memory_bytes: 3712
#include<iostream>
using namespace std;
int main()
{
  int a,b;cin >> a >> b;
  int maximum = -9999;
  if(maximum < a + b)maximum = a + b;
  if(maximum < a*b)maximum = a*b;
  if(maximum < a - b)maximum = a - b;
  cout << maximum;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;

int main() {
    int N;

    cin >> N;

    int sum = 0;
    vector<int> A,B,C;

    for(int i = 0; i < N; i++){
        int a;
        cin >> a;

        A.push_back(a);
    }

    for(int i = 0; i < N; i++){
        int b;
        cin >> b;

        B.push_back(b);
    }

    for(int i = 0; i < N-1; i++){
        int c;
        cin >> c;

        C.push_back(c);
    }

    int b = -1;

    for(int i = 0; i < N; i++){
        sum += B[A[i]-1];

        if(A[i] == b+1){
            sum += C[b-1];
        }

        b = A[i];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
import numpy as np

a = np.array([list((int(_) for _ in input().split())) for x in range(3)])
n = int(input())
b = {int(input()) for _ in range(n)}

wk = "No"
for i in range(3):
    if (set(a[i, :]) <= b) or (set(a[:, i]) <= b):
        wk = "Yes"
if ({a[0][0], a[1][1], a[2][2]} <= b) or ({a[0][2], a[1][1], a[2][0]} <= b):
    wk = "Yes"
print(wk)

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

typedef long long ll;

const ll lim = 2000000000000000000ll;
const int Maxn = 100005;
const int Maxm = 524288;
const int mod = 1000000007;

int N;
ll A, B;
ll S[Maxn];
bool flag[2][Maxm];
int st[2][Maxm];

void downOn(int t, int v)
{
    st[t][v] = 0;
    flag[t][v] = true;
}

void Down(int t, int v)
{
    if (flag[t][v]) {
        downOn(t, 2 * v);
        downOn(t, 2 * v + 1);
        flag[t][v] = 0;
    }
}

void Union(int t, int v)
{
    st[t][v] = (st[t][2 * v] + st[t][2 * v + 1]) % mod;
}

void Clear(int t, int v, int l, int r, int a, int b)
{
    if (l == a && r == b) downOn(t, v);
    else {
        Down(t, v);
        int m = l + r >> 1;
        if (a <= m) Clear(t, 2 * v, l, m, a, min(m, b));
        if (m + 1 <= b) Clear(t, 2 * v + 1, m + 1, r, max(m + 1, a), b);
        Union(t, v);
    }
}

int Get(int t, int v, int l, int r, int a, int b)
{
    if (l == a && r == b) return st[t][v];
    else {
        Down(t, v);
        int m = l + r >> 1;
        int res = 0;
        if (a <= m) res = (res + Get(t, 2 * v, l, m, a, min(m, b))) % mod;
        if (m + 1 <= b) res = (res + Get(t, 2 * v + 1, m + 1, r, max(m + 1, a), b)) % mod;
        return res;
    }
}

void Update(int t, int v, int l, int r, int x, int val)
{
    if (l == r) st[t][v] = val;
    else {
        Down(t, v);
        int m = l + r >> 1;
        if (x <= m) Update(t, 2 * v, l, m, x, val);
        else Update(t, 2 * v + 1, m + 1, r, x, val);
        Union(t, v);
    }
}

int main()
{
    scanf("%d", &N);
    scanf("%lld %lld", &A, &B);
    S[0] = -lim;
    for (int i = 1; i <= N; i++)
        scanf("%lld", &S[i]);
    Update(0, 1, 0, N, 0, 1);
    Update(1, 1, 0, N, 0, 1);
    for (int i = 2; i <= N; i++) {
        int ind = upper_bound(S, S + N + 1, S[i] - B) - S - 1;
        ind = min(ind, i - 2);
        int waysXY = Get(1, 1, 0, N, 0, ind);
        Update(0, 1, 0, N, i - 1, waysXY);
        if (S[i] - S[i - 1] < A)
            Clear(1, 1, 0, N, 0, i - 2);
        ind = upper_bound(S, S + N + 1, S[i] - A) - S - 1;
        ind = min(ind, i - 2);
        int waysYX = Get(0, 1, 0, N, 0, ind);
        Update(1, 1, 0, N, i - 1, waysYX);
        if (S[i] - S[i - 1] < B)
            Clear(0, 1, 0, N, 0, i - 2);
    }
    int res = (Get(0, 1, 0, N, 0, N) + Get(1, 1, 0, N, 0, N)) % mod;
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 4736