akhauriyash/Code-Regression huggingface dataset:
/* * * * * * * * * * * **
*                      *
*	   saurabh8522	   *
*	  I will handle	   *
*		   IT.		   *
*                      *
* * * * * * * * * * * **/
#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ld long double
#define zero(a) memset((a),0,sizeof((a)))
#define one(a) memset((a),1,sizeof((a)))
#define minus(a) memset((a),-1,sizeof((a)))
#define all(g) g.begin(),g.end()
#define ppb pop_back
using namespace std;
typedef long long int ll;
#define MOD 1000000007
ll extgcd(ll a,ll b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extgcd(b,a%b,y,x);y-=a/b*x;return g;}}
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
ll numdigit(ll n){return floor(log10(n)) + 1;}
bool isPowerTwo (ll x) { return x && (!(x&(x-1))); } 
int  main(){
	FastRead;
	ll t=1;
	// cin>>t;
	while(t--){
		ll n;
		cin>>n;
		vector< vector<ll> >v(n,vector<ll>(3));
		for(int i=0;i<n;i++){
			cin>>v[i][0]>>v[i][1]>>v[i][2];
		}
		for(int i=1;i<n;i++){
			v[i][0]=max(v[i-1][1]+v[i][0],v[i-1][2]+v[i][0]);
			v[i][1]=max(v[i-1][0]+v[i][1],v[i-1][2]+v[i][1]);
			v[i][2]=max(v[i-1][0]+v[i][2],v[i-1][1]+v[i][2]);
		}
		cout<<max(v[n-1][0],max(v[n-1][1],v[n-1][2]))<<endl;
	}
}

Measured memory_bytes: 5760
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VII;
typedef vector<string> VS;

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<typeof((c).front())>())
#define SZ(x) ((int)(x).size())
#define MEMSET(c, v) memset((c), v, sizeof(c))

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

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1e9;
// const ll INF = 1e15;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


// --------------------------------------------------------


int main()
{
    int N;
    cin >> N;
    int MAX = static_cast<int>(sqrt(N));
    cout << MAX * MAX << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  if( (a == b) && (b == c) ) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    if (A + B >= 10){
        cout << "error" << endl;
    }else{
        cout << A + B << endl;
    }
    return 0;
}

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

int size,data[N+1];

void maxHeapify(int i)
{
  int l,r,large,tmp;

  l = 2*i;
  r = 2*i+1;
  if(l<=size && data[l]>data[i] )
    large = l;
  else
    large = i;

  if(r<=size && data[r]>data[large])
    large = r;
  if(large != i){
    tmp = data[i];
    data[i] = data[large];
    data[large] = tmp;
    maxHeapify(large);
  }
}

int extract()
{
  int maxv;

  if(size < 1)
    return;

  maxv = data[1];
  data[1] = data[size--];
  maxHeapify(1);

  return maxv;
}

void increaseKey(int i, int k)
{
  int tmp;

  if(k < data[i])
    return;

  data[i] = k;

  while(i>1 && data[i/2]<data[i] ){
    tmp = data[i];
    data[i] = data[i/2];
    data[i/2] = tmp;
    i = i/2;
  }
}

void insert(int k)
{
  size++;
  data[size] = -1000000001;
  increaseKey(size,k);
}

int main()
{
  int k,m;
  char A[20];

  while(1){
    scanf("%s",A);

    if(A[0] == 'i'){
      scanf("%d",&k);
      insert(k);
    }
    else if(strcmp(A,"extract") == 0 ){
      m = extract();
      printf("%d\n",m);
    }
    else break;
  }

  return 0;
}


Measured memory_bytes: 5608
def cmb(n, r, mod):
    if (r<0 or r>n):
        return(0)
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
N = 10**4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2,N+1):
    g1.append(( g1[-1] * i ) % mod)
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
n,k=map(int,input().split())
for i in range(1,k+1):
    ans = cmb(n-k+1,i,mod)*cmb(k-1,i-1,mod)
    print(ans%mod)

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

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

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <cstdlib>
#define PI acos(-1.0)
#define ll long long int
#define db double
#define ull unsigned long long int
#define Fill(x,y) memset(x,y,sizeof(x))
#define bug printf("!!!!!!\n");
#define fi first
#define se second
using namespace std;
const db eps = 1e-6;
const int inf = 0x3f3f3f3f; //用这个可以直接mem
const ll INF = 1e18;
const int mod = 1e9+7;
const int maxn = 1e5+5;
int cas=1;
void solve()
{
    ll a = 2,b = 1,ans;
    int n; scanf("%d",&n);
    if(n==1) cout << b << endl;
    else {
        for(int i=2;i<=n;i++){
            ans = a+b;
            a = b;
            b = ans;
        }
        cout << ans << endl;
    }
}
int main()
{
    // freopen("in.txt","r",stdin);
    //  freopen("out.txt","w",stdout);
    int t = 1 ;
    //scanf("%d",&t);
    while(t--){
       // printf("Case %d: ", cas++);
        solve();
        //printf("\n");
    }
}









Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ans = new int[n];
		for (int i = 1; i <= n; i++) {
			ans[sc.nextInt() - 1] = i;
		}
		
		for (int i : ans) {
			System.out.print(i + " ");
		}
		System.out.println();
	}
}

Measured memory_bytes: 62304
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto M = RD;
	auto a = new long[](M);
	auto c = new uint[](M);
	auto list = new long[][](N);
	foreach (i; 0..M)
	{
		a[i] = RD;
		auto b = RD;
		auto tmp = RDA(-1);
		foreach (e; tmp)
		{
			uint bit = 1 << e;
			c[i] |= bit;
			list[e] ~= i;
		}
	}

	uint allOne = (1 << N) - 1;
	long[2][long] memo;
	long dfs(uint s, long cost)
	{
		if (s == allOne) return cost;
		auto key = s;
		if (memo.get(key, [-1, -1])[0] != -1)
		{
			auto d = cost - memo[key][1];
			if (d >= 0) return memo[key][0];
			auto tmp = memo[key];
			memo[key] = [tmp[0]+d, tmp[1]+d];
		}

		auto pos = bsf(allOne ^ s);
		long res = long.max;
		foreach (i; list[pos])
		{
			res = min(res, dfs(s | c[i], cost + a[i]));
		}
		memo[key] = [res, cost];
		return res;
	}

	auto ans = dfs(0, 0);

	writeln(ans == long.max ? -1 : ans);
	stdout.flush();
	debug readln();
}

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

int main() {
  
  string S;
  cin >> S;
  
  int N = S.size();
  sort(S.begin(), S.end());
  
  vector<bool> tof(26,false);
  
  int cnt=0;
  for(int i=0; i<N; i++){
    cnt = (int)(S.at(i) - 'a');
    tof.at(cnt) = true;
  } 
  
  for(int i=0; i<26; i++){
    if(tof.at(i) == false){
      cout << (char)(i + 'a') <<endl;
      return 0;
    }
  }
  
  cout << "None" << endl;
  
}


Measured memory_bytes: 3652
n = int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

if n == 1:
    print(0)
    quit()
f = factorization(n)
ans = 0
c = len(f)
for i in range(c):
    s = 0
    g = f[i][1]
    if g == 2:
        ans += 1
    else:
        for j in range(g):
            s += j + 1
            f[i][1] -= j+1
            if s > g:
                break
            ans += 1
print(ans)

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

using namespace std;

struct segtree{
    int n;
    vector<long long> d;
    segtree(int mx){
        n = 1;
        while(n < mx) n <<= 1;
        d = vector<long long>(n << 1);
    }
    long long query(int a, int b, int i = 1, int l = 0, int r = -1){
        if(r == -1) r = n;
        if(a <= l && r <= b) return d[i];
        long long res = 0;
        int c = (l + r) >> 1;
        if(a < c) res = max(res, query(a, b, i << 1, l, c));
        if(c < b) res = max(res, query(a, b, i << 1 | 1, c, r));
        return res;
    }
    void update(int i, long long x){
        i += n;
        while(i){
            d[i] = max(d[i], x);
            i >>= 1;
        }
    }
};

int main(){
    int n, ans = 0;
    cin >> n;
    vector<int> h(n), a(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int max_h = *max_element(begin(h), end(h));
    segtree st(max_h + 1);
    for(int i = 0; i < n; i++){
        st.update(h[i], a[i] + st.query(0, h[i]));
    }
    cout << st.query(0, max_h + 1) << endl;
    return 0;
}


Measured memory_bytes: 5888
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
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 FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;

string Cipher();
string String();
string Letter();
string plusLetter(string str);
string minusLetter(string str);

int p;
string s;

string Cipher() {
	string ret;
	while (p < s.size() && s[p] != ']') {
		ret += String();
	}
	return ret;
}

string String() {
	string ret;
	if (s[p] == '[') {
		p++;
		ret = Cipher();
		reverse(ALL(ret));
		p++;
	}
	else {
		ret = Letter();
	}
	return ret;
}

string Letter() {
	string ret;
	if (s[p] == '+') {
		p++;
		ret = Letter();
		ret = plusLetter(ret);
	}
	else if (s[p] == '-') {
		p++;
		ret = Letter();
		ret = minusLetter(ret);
	}
	else {
		ret = string(1, s[p]);
		p++;
	}
	return ret;
}

string plusLetter(string str) {
	string ret;
	if (str == "?") {
		ret = "?";
	}
	else if (str == "Z") {
		ret = "A";
	}
	else {
		str[0]++;
		ret = str;
	}
	return ret;
}

string minusLetter(string str) {
	string ret;
	if (str == "?") {
		ret = "?";
	}
	else if (str == "A") {
		ret = "Z";
	}
	else {
		str[0]--;
		ret = str;
	}
	return ret;
}

int main() {
	while (cin >> s, s != ".") {
		p = 0;
		string ans = Cipher();
		REP(i, ans.size()) {
			if (ans[i] == '?') {
				ans[i] = 'A';
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  int s[m];
  char b[m];
  rep(i,m) {cin >> s[i] >> b[i];}
  switch(n){
  case 1:
    for(int i=0;i<10;i++){
    string str = to_string(i);
    int flag = 1;
      rep(j,m){
	if(str[s[j]-1]!=b[j]){
	  flag = 0;
	}
      }
      if(flag==1){
	cout << str << endl;
	return 0;
      }
    }
  case 2:
    for(int i=10;i<100;i++){
    string str = to_string(i);
    int flag = 1;
      rep(j,m){
	if(str[s[j]-1]!=b[j]){
	  flag = 0;
	}
      }
      if(flag==1){
	cout << str << endl;
	return 0;
      }
    }

  case 3:
    for(int i=100;i<1000;i++){
    string str = to_string(i);
    int flag = 1;
      rep(j,m){
	if(str[s[j]-1]!=b[j]){
	  flag = 0;
	}
      }
      if(flag==1){
	cout << str << endl;
	return 0;
      }
    }
  }
  cout << "-1" << endl;
  return 0;
}


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

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

int main() {
	
	int n;
	cin >> n;
	vector<ll> t(n);
	rep(i, n) cin >> t[i];
	rep(i, n-1){
		t[i+1] = t[i] / gcd( t[i], t[i+1]) * t[i+1];
	}
	cout << t[n-1] << endl;
	return 0;
}

Measured memory_bytes: 256
from itertools import product

n = int(input())

num_753 = []
for i in range(3, 10):
    for a in product(('7','5','3'), repeat=i):
        if a.count('7') > 0 and a.count('5') > 0 and a.count('3') > 0:
            num_753.append(int(''.join(a)))

num_753.sort()
for i, v in enumerate(num_753):
    if v > n:
        print(i)
        break
else:
    print(i+1)


Measured memory_bytes: 4184
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

def main():
    K = int(input())

    ans = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            for k in range(1, K+1):
                ans += gcd_list([i, j, k])
    print(ans)

main()

Measured memory_bytes: 69312
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    unordered_map<string, int> um;
    int n; cin>>n;
    rep(i,n){
        string s;cin>>s;
        um[s]++;
    }
    vector<string> res = {"AC", "WA", "TLE", "RE"};
    for(string s:res){
        cout<<s<<" x "<<um[s]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3660
#include <iostream>

using namespace std;

int main()
{
    char s;
    cin>>s;
    if(s=='a' || s=='e' || s=='i' || s=='o' ||s=='u')
    {
        cout<<"vowel"<<endl;
    }
    else
    {
        cout<<"consonant"<<endl;
    }
    return 0;
}


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

using namespace std;

#define pii pair<int,int>
#define pll pair<ll,ll>
#define ll long long
#define s second
#define f first

vector<int> g[100005];
map<pll,ll> d;
bool color[100005];
int n,u,v,w;

bool cmp(pii a,pii b)
{
    return a.f<b.f;
}

void dfs(int x,int p,ll dist){
 if(p!=-1){
    dist+=d[make_pair(x,p)];
 }
 color[x]=dist%2;
 for(auto i:g[x]){
    if(i!=p){
        dfs(i,x,dist);
    }
 }
}

int main(){
  cin >> n;
  for(int i=0;i<n-1;++i){
    cin >> u >> v >> w;
    --u;--v;
    d[make_pair(u,v)]=d[make_pair(v,u)]=w;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0,-1,0);
  for(int i=0;i<n;++i){
    cout << color[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 22016
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;

int a[N],num[N],n,m;
int main()
{
	scanf("%d%d",&n,&m);
	a[1]=1;
	for(int i=1;i<=n;i++)
		num[i]=1;
	int x,y;
	while(m--){
		scanf("%d%d",&x,&y);
		if(!num[x])continue;
		if(a[x])a[y]=1;
		--num[x],++num[y];
		if(!num[x])a[x]=0;
	}
	int sum=0;
	for(int i=1;i<=n;i++)
		if(a[i])sum++;
	cout<<sum<<endl;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;
int a, b;
int main(){
    cin>>a>>b;
    if (a+b>a-b && a+b>=a*b)cout<<a+b<<endl;
    else if (a*b>a+b && a*b>a-b)cout<<a*b<<endl;
    else cout<<a-b<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cassert>
#include<algorithm>
using namespace std;
int n, m, q, a[100009], b[100009], c[100009], d[100009]; vector<int>Z; bool used[100009], OK;
int main() {
	cin >> n >> m >> q; for (int i = 0; i < m; i++)b[i] = -1;
	for (int i = 1; i <= q; i++)cin >> a[i], a[i]--;
	for (int i = q; i >= 1; i--) { if (used[a[i]] == false) { used[a[i]] = true; Z.push_back(a[i]); } }
	int E = 1e9; for (int i = 0; i < m; i++) { if (used[i] == false)E = min(E, i); }
	if (E > Z[Z.size() - 1]) {
		while (Z.size() >= 2 && Z[Z.size() - 2] < Z[Z.size() - 1])Z.pop_back();
		if (Z[Z.size() - 1] == 0)Z.pop_back();
	}
	for (int i = 0; i < Z.size(); i++)b[Z[i]] = i;
	if (Z.size() == 0) { cout << "Yes" << endl; return 0; }
	if (n*Z.size() > q) { cout << "No" << endl; return 0; }
	for (int i = q; i >= 1; i--) {
		int num = b[a[i]]; if (num == -1)continue;
		if (c[num] == n || d[c[num]] < num)continue;
		d[c[num]]++; c[num]++;
	}
	for (int i = 0; i < n; i++) { if (d[i] != Z.size())OK = true; }
	if (OK == true)cout << "No" << endl; else cout << "Yes" << endl;
	return 0;
}

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

int main() {
	int N, ans = 0;
	cin >> N;
	ans = N / 3;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    int num,count[4]={0},i;
    char blood[2];
    while(scanf("%d,%s",&num,blood)!=EOF) {
        if (blood[0]=='A'&&blood[1]=='B') {
        	count[2]++;
        } else if (blood[0]=='A') {
        	count[0]++;
        } else if (blood[0]=='B') {
        	count[1]++;
        } else if (blood[0]=='O') {
        	count[3]++;
        }
    }
    for(i=0;i<4;i++) printf("%d\n",count[i]);
    return 0;
}

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

const int MAX_W = 100, MAX_H = 100;
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
int W, H;
int x, y;
char field[MAX_W][MAX_H];
bool check[MAX_W][MAX_H];
int result;

void dfs(int x, int y);
void solve();

int main(){
	while(1){
		result = 0;
		for(int i=0; i<MAX_W; i++){
			for(int j=0; j<MAX_H; j++){
				check[i][j] = true;
			}
		}

		cin >> H;
		cin >> W;
		if(W==0 && H==0) break;

		for(int i=0; i<H; i++){
			for(int j=0; j<W; j++){
				cin >> field[j][i];
			}
		}
		

		solve();
		cout << result << endl;
	}

	return 0;
}

void dfs(int x, int y){
	check[x][y] = false;

	for(int i=0; i<4; i++){
		int xnew = x + dx[i];
		int ynew = y + dy[i];

		if(0<=xnew && xnew<=W-1 && 0<=ynew && ynew<=H-1 && check[xnew][ynew] && field[x][y]==field[xnew][ynew]) dfs(xnew, ynew);
	}
}

void solve(){
	for(int i=0; i<W; i++){
		for(int j=0; j<H; j++){
			if(check[i][j]){
				dfs(i, j);
				result++;
			}
		}
	}
}

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

using namespace std;

int main()
{
  int n;
  while(cin >> n, n){
    bool schedule[51][31];
    fill(schedule[0], schedule[51], false);
    for(int i = 0; i < n; i++){
      int f; cin >> f;
      for(int j = 0; j < f; j++){
	int d; cin >> d;
	schedule[i][d] = true;
      }
    }
    long long dp[51];
    fill(dp, dp + 51, 0LL);
    int ans = -1;
    for(int i = 0; i < n; i++) dp[i] |= 1LL << i;
    for(int i = 1; i <= 30; i++){
      long long p = 0LL;
      for(int j = 0; j < n; j++){
	if(schedule[j][i]) p |= dp[j];
      }
      for(int j = 0; j < n; j++){
	if(schedule[j][i]) dp[j] = p;
      }
      if(p == (1LL << n) - 1){
	ans = i;
	break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<set>
#include<functional>
#include<cmath>

#define Vi vector<int>
#define Vs vector<string>
#define PB push_back
#define ALL(a) a.begin(),a.end()
#define FOR(i,n) for(int i=0;i<n;i++)
#define DEB cout<<"!"
using namespace std;

typedef pair<int,int> pii;
typedef pair<int,pii> piii;

int main(){
  long long n,a,b;
  cin>>n>>a>>b;
  long long ans=0;
  if(n==1&&a!=b){
  }else if(a>b){
  }else if(a==b){
    ans=1;
  }else{
    ans=b*(n-1)+a-(b+a*(n-1))+1;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
n = gets.to_i
as = gets.chomp.split.map(&:to_i)
gcd_f = [as[0]]
gcd_b = [as[-1]]
max = 0
(1..n-1).each do |i|
  gcd_f.push(as[i].gcd(gcd_f[-1]))
  gcd_b.push(as[n-1-i].gcd(gcd_b[-1]))
end
(0..n-3).each do |i|
  max = [max,gcd_f[i].gcd(gcd_b[n-3-i])].max
end
max = [max,gcd_f[n-2],gcd_b[n-2]].max
puts max

Measured memory_bytes: 13800
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int a[n], b[n], c[n];
    rep(i, 0, n) {
        cin >> a[i] >> b[i] >> c[i];
    }

    int dp[n + 10][3] = {};
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    rep(i, 0, n) {
        dp[i + 1][0] = a[i + 1] + max(dp[i][1], dp[i][2]);
        dp[i + 1][1] = b[i + 1] + max(dp[i][2], dp[i][0]);
        dp[i + 1][2] = c[i + 1] + max(dp[i][0], dp[i][1]);
    }

    cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) << endl;
    return 0;
}


Measured memory_bytes: 2560
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

struct aa {
	int len;
	int y;
	int x;
	int cost;
};

class Compare {
public :
	bool operator()(const aa&l, const aa&r) {
		return l.cost>r.cost;
	}
};

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

int main() {
	int H,W;cin>>H>>W;
	vector<vector<vector<int>>>memo(H*W+1,vector<vector<int>>(H,vector<int>(W,1e9)));
	vector<vector<int>>field(H,vector<int>(W));
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			cin>>field[i][j];
		}
	}

	memo[0][0][0]=0;
	priority_queue<aa,vector<aa>,Compare>que;
	que.push(aa{ 0,0,0,0 });
	while (!que.empty()) {
		aa atop(que.top());
		que.pop();

		const int now_len=atop.len;
		const int now_x=atop.x;
		const int now_y=atop.y;
		const int now_cost=atop.cost;

		for (int way = 0; way < 4; ++way) {
			const int next_len=now_len+1;
			const int next_x=now_x+dx[way];
			const int next_y=now_y+dy[way];

			if (next_x >= 0 && next_x < W&&next_y >= 0 && next_y < H&&next_len<=H*W) {
				const int next_cost=now_cost+(2*next_len-1)*field[next_y][next_x];

				if (memo[next_len][next_y][next_x] > next_cost) {
					memo[next_len][next_y][next_x]=next_cost;
					que.push(aa{ next_len,next_y,next_x,next_cost });
				}
			}
		}

	}

	int ans=1e9;
	for (int len = 0; len <= H*W; ++len) {
		ans=min(ans,memo[len][H-1][W-1]);
	}
	cout<<ans<<endl;


	return 0;
}




Measured memory_bytes: 11144
#include<iostream>
#include<cmath>
#include<queue>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<cstring>
#include<climits>
#include<sstream>
#include<deque>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>

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

using namespace std;

typedef long long ll;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;

int main(){
  int h,w,k;
  cin >> h >> w >> k;
  bool ok = false;
  if( k == 0 || k == h * w ) ok = true; 
  if( k <= h * w && ( k % h == 0 || k % w == 0 ) ) ok = true;
  rep(i,h) {
    rep(j,w) {
      int score = ( i + 1 ) * w;
      //cout << "(0) = " << score << endl;
      score -= ( i + 1 ) * ( j + 1 );
      //cout << "(1) " << i << " " << j << " = " << score << endl;
      score += ( j + 1 ) * ( h - ( i + 1 ) );
      //cout << "(2) " <<i << " " << j << " = " << score << endl;
      if( score == k ) {
	ok = true;

      }
    }
  }
  if( k > h * w ) ok = false;
  puts(ok?"Yes":"No");
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<utility>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<limits>
#include <bitset>      


#define LL long long
#define f first
#define s second
#define pb push_back
#define mp make_pair


using namespace std;

const LL max_LL = numeric_limits<LL>::max(); 

LL dp[100005];
LL h[100005];
int n, k;

 

int main(){

    cin >> n >> k;

    memset(dp, 1000000, sizeof dp);

    for(int i = 0; i < n; i++) cin >> h[i];


    dp[0] = 0;

    for(int i = 1; i <= min(k,n) ; i++){
        dp[i] = abs(h[i] - h[0]);
     }

    for(int i = 1; i < n; i++){
        for(int j = 1; j <= k; j++){
            if(j <= i){
                dp[i] = min(dp[i], dp[i-j] + (LL)abs(h[i] - h[i-j]));
              }
          }       
       }
    
   
    cout << dp[n-1];
    
    return 0;

}


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

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String t = scanner.next();
		char[] sc = new char[s.length()];
		char[] tc = new char[t.length()];
		for (int i = 0; i < s.length(); i++) {
			sc[i] = s.charAt(i);
		}
		for (int i = 0; i < t.length(); i++) {
			tc[i] = t.charAt(i);
		}
		Arrays.sort(sc);
		Arrays.sort(tc);
		String ans = "No";
		for (int i = 0,j=t.length()-1; i < s.length() && j >= 0; i++,j--) {
			if(sc[i] < tc[j]) {
				ans = "Yes";
				break;
			}else if(sc[i] == tc[j]){
				if(s.length()<t.length() && i== s.length()-1){
					ans = "Yes";
				}
			}
		}
		System.out.println(ans);
	}
}

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

//#define DEBUG

#ifdef DEBUG
using std::endl;
std::ifstream cin("input.txt");
std::ofstream cout("output.txt");
#endif // DEBUG
#ifndef DEBUG
using namespace std;
#endif // DEBUG

template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}


void func_to_create(){
    std::map<int, int> com_map;
    unsigned int N ;
    cin >> N;

    for(int i = 2 ; i <= N ; i++){
        unsigned int a;
        cin >> a;
        if( com_map.find(a) != com_map.end()){
            com_map[a] = com_map[a] + 1;
        }else{
            com_map[a] = 1;
        }
    }

    for(int i = 1 ; i <= N ; i++){
        if(com_map.find(i) != com_map.end()){
            cout << com_map[i] << endl;
        }else{
            cout << 0 << endl;
        }
    }
}
int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 4;
    while(TEST_CASES--){
    #endif // DEBBUG

    func_to_create();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}


Measured memory_bytes: 13032
S = input()
if S == "SUN":
    ans = 7
elif S == "MON":
    ans = 6
elif S == "TUE":
    ans = 5
elif S == "WED":
    ans = 4
elif S == "THU":
    ans = 3
elif S == "FRI":
    ans = 2
else: ans = 1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test(n) cout << "test" << n << endl;
#define fixsp(n) fixed << setprecision(n)
#define defsp(n) defaultfloat << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL)
#define MOD 1000000007
#define iikae auto&
#define vector3D(K, N, M, DP) vector<vector<vector<ll>>> DP(K, vector<vector<ll>>(N, vector<ll>(M)));
#define vector4D(K, N, M, O, DP) vector<vector<vector<vector<ll>>>> DP(K, vector<vector<vector<ll>>>(N, vector<vector<ll>>(M, vector<ll>(O))));
#define zenbu(a) a.begin(), a.end()
#define rzenbu(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long;using ld = long double;using P = pair<ll,ll>;
template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}
template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};
template<typename T> ll comb(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}

/* ここからコード開始 */

int main(){
  kyopro;
  string S;
  cin >> S;
  ll y{};
  if(S.at(0) == S.at(1)&& S.at(2) == S.at(3)&& S.at(0) != S.at(2)) y = 1;
  if(S.at(0) == S.at(2)&& S.at(1) == S.at(3)&& S.at(0) != S.at(1)) y = 1;
  if(S.at(0) == S.at(3)&& S.at(1) == S.at(2)&& S.at(0) != S.at(1)) y = 1;
  if(y) cout << "Yes" << rt;
  else cout << "No" << rt;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void debug() { std::cerr << '\n'; }
template <class H, class... T> void debug(H &&head, T &&... args) {
    std::cerr << head;
    sizeof...(args) == 0 ? std::cerr << "" : std::cerr << ' ';
    debug(std::forward<T>(args)...);
}
template <class T> void debug(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cerr << v[i];
        i == v.size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
    }
}
template <class T> void debug(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cerr << v[i][j];
            j == v[i].size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
        }
    }
}

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

    int N, M;
    cin >> N >> M;
    vector<int> x(M), y(M);
    REP(i, M) {
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
    }
    vector<bool> red(N, false);
    red[0] = true;
    vector<int> cnt(N, 1);

    REP(i, M) {
        if (red[x[i]]) {
            red[y[i]] = true;
        }
        cnt[x[i]]--;
        cnt[y[i]]++;

        if (cnt[x[i]] == 0) {
            red[x[i]] = false;
        }
    }
    int ans = 0;
    for (auto &&i : red) {
        if (i)
            ans++;
    }

    print(ans);

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
 
using namespace std;
 
 
bool isDivisible3(int n) {
    return n % 3 == 0;
}
 
bool includes3(int n) {
    if (n % 10 == 3) {
        return true;
    } else {
        n /= 10;
        if (n) {
            return includes3(n);
        }
        return false;
    }
}
 
int main() {
    int n;
    cin >> n;
 
    for (int i = 1; i <= n; ++i) {
        if (isDivisible3(i) || includes3(i)) {
            cout << ' ' << i;
        }
    }
 
    cout << endl;
    return 0;
}

Measured memory_bytes: 1160
fun main(args: Array<String>) {
    val (k,s)= readLine()!!.split(" ").map { it.toInt() }
    var count=0

    for(a in 0..k)for(b in 0..k) {
        val c=s-a-b
        if(c in 0..k) count++
    }
    println(count)
}

Measured memory_bytes: 37556
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <stack>
#include <unordered_map>
using namespace std;



int main(){
    int n;
    cin >> n;
    vector<int> v;
    int i = 0;
    int sum = 0;
    int s;
    
    for(i = 0; i < n; i++){
        cin >> s;
        if(s%10 != 0){
            v.push_back(s);
        }
        sum += s;
    }
    
    sort(v.begin(), v.end());
    
    if(sum%10 == 0){
        if(v.size() != 0){
            sum -= v[0];
        }else{
            sum = 0;
        }
    }
    
    cout << sum << endl;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        m: usize,
        broken: [usize; m],
    }

    let mo = 10isize.pow(9) + 7;
    let mut dp = vec![0; n+1];

    dp[0] = 1;
    dp[1] = 1;
    for &b in &broken {
        dp[b] = -1;
    }

    for i in 2..=n {
        if dp[i] < 0 {
            continue;
        }
        if dp[i - 1] >= 0 {
            dp[i] = (dp[i] + dp[i - 1]) % mo;
        }
        if  dp[i - 2] >= 0 {
            dp[i] = (dp[i] + dp[i - 2]) % mo;
        }
    }
    
    println!("{}", dp[n]);
}


Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
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;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;

ll dp[100010][13];
int main( ){
    string S;
    cin>>S;
    const ll mod=1e9+7;
    dp[0][0]=1;
    rep(i,1,10)dp[0][i]=0;
    int N=S.size();
    rep(i,0,N){
        if(S[i]=='?'){
            rep(pr,0,13)
                rep(d,0,10)
                    dp[i+1][(pr*10+d)%13]+=dp[i][pr],dp[i+1][(pr*10+d)%13]%=mod;
        }
        else{
            rep(j,0,13)
                dp[i+1][(S[i]-'0'+j*10)%13]+=dp[i][j],dp[i+1][(S[i]-'0'+j*10)%13]%=mod;
        }
    }
    cout<<dp[N][5]<<endl;
    return 0;
}




Measured memory_bytes: 10624
#include <vector>
#include <set>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
	int n,a,b;
	scanf("%d%d%d",&n,&n,&n);
	vector<pair<int,int> >v;
	multiset<int>se;
	for(int i=0;i<n;i++){
		scanf("%d%d",&a,&b);
		v.push_back(make_pair(a,b));
		se.insert(b);
	}
	sort(v.begin(),v.end());
	int r=min(v.rbegin()->first,*se.rbegin());
	for(int i=0;i<n-1;i++){
		se.erase(se.find(v[i].second));
		r=min(r,v[i].first+*se.rbegin());
	}
	printf("%d\n",r);
}

Measured memory_bytes: 7952
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}


//#########################################

int main() {

string s;
cin>>s;
if(s[0]==s[2]){
cout<<"Yes";
}
else
cout<<"No";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)


int main(){

    fast;
    int x;
    cin>>x;
    if(x>=30)
    {
    	cout<<"Yes\n";
	}
	else
	{
		cout<<"No";
	}
    

}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(a * n, b) << endl;
    return 0;
}



Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M,*UV,S,T = map(int,read().split())

it = iter(UV)
G = [[] for _ in range(1+N+N+N)]
for x, y in zip(it, it):
    x1=x+N; x2=x1+N;
    y1=y+N; y2=y1+N;
    G[x].append(y1)
    G[x1].append(y2)
    G[x2].append(y)

INF = 10 ** 15
dist = [INF] * (N+N+N+1)
dist[S] = 0
q = [S]
while q:
    qq = []
    for x in q:
        for y in G[x]:
            if dist[y] != INF:
                continue
            qq.append(y)
            dist[y] = dist[x] + 1
            if y == T:
                break
    q = qq

d = dist[T]

answer = -1 if d == INF else d//3
print(answer)



Measured memory_bytes: 64648
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define mp make_pair
#define inf 1000000007
#define int long long
using namespace std;
int dp[5140][5140];
int modpow(int x,int k){
	// x ^ k mod inf
	int p2[55],res=1;
	p2[0]=1;p2[1]=x%inf;
	for(int i=2;i<=50;i++){
		p2[i]=p2[i-1]*p2[i-1];
		p2[i] %= inf;
	}
	for(int i=1;i<=50;i++){
		if(k%2==1){
			res *= p2[i];
			res %= inf;
		}
		k /= 2;
	}
	return res;
}
signed main(){
	int n;
	string str;
	cin>>n>>str;
	int s=str.size();
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=n;j++){
			dp[i][j] += dp[i-1][j+1];
			dp[i][j] %= inf;
			if(j!=0){ dp[i][j] += 2*dp[i-1][j-1]; dp[i][j] %= inf;}
			else{ dp[i][j] += dp[i-1][j]; dp[i][j] %= inf;}
		}
	}
	int res = modpow((ll)2,(ll)inf-2);
	res = modpow(res,s);
	res *= dp[n][s];
	res %= inf;
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 203008
<?php
$pointsN = trim(fgets(STDIN));
$arrN = explode(" ", $pointsN);  //半角スペース区切りの要素を格納
$a1 = (int)($arrN[0]/100);
$a2 = (int)$arrN[0]%100;

 if($a1<=12 && $a2<=12 && $a1 >0 && $a2>0){
   echo "AMBIGUOUS"."\n";
 }
 elseif( $a1<=12 && $a1 >0 && $a2>=0){
   echo "MMYY"."\n";
 }
 elseif($a2<=12 && $a1 >=0 && $a2>0){
   echo "YYMM"."\n";
 }
 else{
   echo"NA"."\n";
}
?>

Measured memory_bytes: 3700
n = int(input())

a = list(map(int,input().split()))

cntall = 0
cnt = 0

for i in a:
    if not(i & 1):
        cntall += 1
        if (i%5==0) or (i%3==0):
            cnt += 1
            
if cntall == cnt:
    print("APPROVED")
else:
    print("DENIED")
            
        

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

#define REP(i, n) for(int i = 0; i < (int) (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define INF 1e9

using namespace std;

int make_diff(int orgn, int digit){
  vector<int> component(digit, 0);
  REP(i, digit){
    component[i] = orgn % 10;
    orgn /= 10;
  }
  sort(ALL(component));
  int maxim = 0; int minim = 0;
  REP(i, digit){
    maxim *= 10;
    minim *= 10;
    maxim += component[digit-i-1];
    minim += component[i];
  }
  return maxim - minim;
}

int main(){
  int a0, l;
  while(cin >> a0 >> l and a0 + l){
    vector<int> value(25);
    set<int> appear;
    appear.insert(a0);
    value[0] = a0;
    int nval = a0;
    int j = 0;
    for(int i=0;; i++){
      nval = make_diff(nval, l);
      value[i+1] = nval;
      appear.insert(nval);
      if(appear.size() < i+2){
        j = i+1;
        break;
      }
    }
    int first = 0;
    REP(i, 22)
      if(value[i] == value[j]){ first = i; break; }
    cout << first << " " << value[j] << " " << j - first << endl;
  }
  return 0;
}

Measured memory_bytes: 3104
import bisect
N = int(input())

def bisect_right_reverse(a, x, lo=0, hi=None):
    """Return the index where to insert item x in list a, assuming a is sorted.
    The return value i is such that all e in a[:i] have e <= x, and all e in
    a[i:] have e > x.  So if x already appears in the list, a.insert(x) will
    insert just after the rightmost x already there.
    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    """

    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if x > a[mid]: hi = mid
        else: lo = mid+1
    return hi


c = []
for i in range(N):
    n = int(input())
    index = bisect_right_reverse(c,n)
    #print(index)
    if index == len(c):
        c.append(n)
    else:
        c[index] = n
    #print(c)

print(len(c))

Measured memory_bytes: 7096
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define ff first
#define ss second  
#define endl '\n'
#define pb push_back
#define t_case ll tt; cin>>tt; while (tt--)
#define all(v) v.begin(),v.end()
#define ub(a,x) upper_bound(all(a),x)-a.begin()
#define lb(a,x) lower_bound(all(a),x)-a.begin()
#define fr(a,b,c) for (ll a=b;a<c;a++)
#define take(xx,n) for (int i=0;i<n;i++) cin>>xx[i];
#define take1(xx,n) for (int i=1;i<=n;i++) cin>>xx[i];
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
int main() 
{
	fastio
	//t_case
	{
		ll sum=0,ans=1,f=1,n,m,k,x,y,z  ;cin>>n>>k  ;
		ll a[n+1]; take1 (a,n);
		ans=1;
		fr(i,1,k+1) ans*=a[i];
		fr (i,k+1,n+1){
			if (a[i-k]<a[i]) cout<<"Yes";
			else cout<<"No";
			cout<<endl;
		}
		//cout<<endl;
	}
	return 0;
}
 

Measured memory_bytes: 5200
#include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
using namespace std;

double pi = acos(-1);
double f(int a, int b, double th){
    if (th > pi / 2.0) return 0.0;
    double res;
    if (a * tan(th) <= b) {
        res = a * a * b - a * a * a * tan(th) / 2.0;
    } else {
        res = b * b / tan(th) * a / 2.0;
    }
    return res;
}

int main() {
    int a, b, x;
    cin >> a >> b >> x;
    double ok = pi / 2.0;
    double ng = 0.0;
    for (int _ = 0; _ < 10000; _++) {
        double mid = (ok + ng) / 2.0;
        if (f(a, b, mid) < x)
            ok = mid;
        else
            ng = mid;
    }
    cout << fixed << setprecision(10) << ok / pi * 180 << endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
using namespace std;
int a[9], b[9], c[9] = { 0,1,2,3,4,5,6,7,8 };
int main() {
	int n; cin >> n;
	for (int v = 0; v < n; v++) {
		for (int i = 0; i < 18; i++) { if (i < 9)cin >> a[i]; else cin >> b[i - 9]; }
		int cnt = 0; sort(a, a + 9); sort(b, b + 9);
		do {
			int c2 = 0;
			for (int i = 0; i < 9; i++) {
				if (a[i] > b[c[i]])c2 += a[i] + b[c[i]];
			}
			if (c2 > 85)cnt++;
		} while (next_permutation(c, c + 9));
		printf("%.5f %.5f\n", 1.0*cnt / 362880, 1.0 - 1.0*cnt / 362880);
	}
}

Measured memory_bytes: 3184
package main
 
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)
 
func run() {

	var N int64;
    N = nextInt();
    var D int64;
    D = nextInt();
	solve(N, D);

}

func solve(N int64, D int64){
	Println((N+(D*2)) / (D*2+1))
}


// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024
 
func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}
 
func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}
 
func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}
 
func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int64 {
	a, err := strconv.ParseInt(next(),10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}


type IntHeap []int
func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

/////数字と文字
// 基本クラス
type NS struct {
    Num int
    Str string
}

//////　数字と数字
// 基本クラス
type NN struct {
    Num1 int
    Num2 int
}

 
func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}



Measured memory_bytes: 2816