akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define INF         1e9
#define fastRead    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;


const int MAX = 2000 + 3;
ll dp[MAX][MAX];
int n;
vector<pll>vec;

ll solve(int l , int r , int id) {

    if(id == n ) return 0;
    
    ll &ret = dp[l][r];
    if( ret != -1 ) return ret;
    
    ll tmp1 = solve(l+1 , r , id+1) + vec[id].uu * abs(vec[id].vv - l);
    ll tmp2 = solve(l , r-1 , id+1) + vec[id].uu * abs(vec[id].vv - r);
    
    ret = max(tmp1 , tmp2);
    return ret;
    
    
    
}

int main()
{
    fastRead;
    cin>>n;
    for(int i =0 ; i < n ; i++ ) {
        ll val;
        cin>>val;
        vec.push_back({val , i});
    }
    sort(vec.rbegin() , vec.rend());
    
    memset(dp , - 1,  sizeof dp);
    cout<<solve(0 , n-1 , 0)<<'\n';
    return 0;
    
}


Measured memory_bytes: 35176
X,Y,Z,K=map(int,input().split())
def INPUT():
    ans=list(map(int,input().split()))
    ans.sort(reverse=True)
    return ans
A=INPUT()
B=INPUT()
C=INPUT()
ans=[]
for i in range(1,1+X):
    for j in range(1,1+Y):
        if i*j-1>=K:
            break
        for k in range(1,1+Z):
            if i*j*k-1>=K:
                break
            ans+=[A[i-1]+B[j-1]+C[k-1]]
ans.sort(reverse=True)
for i in range(K):
    print(ans[i])

Measured memory_bytes: 8708
import sys
for e in sys.stdin:
 e=list(map(float,e.split(',')));n=0
 for i in range(0,8,2):
  if(e[i]-e[(2+i)%8])*(e[(5+i)%8]-e[(3+i)%8])-(e[1+i]-e[(3+i)%8])*(e[(4+i)%8]-e[(2+i)%8])>0:n+=1
 print(['YES','NO'][n%4>0])


Measured memory_bytes: 5580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcdEx(ll a, ll b, ll *x, ll *y) {
    if (!a) {*x = 0; *y = 1; return b;}
    ll x1, y1, gcd = gcdEx(b % a, a, &x1, &y1); *x = y1 - (b / a) * x1; *y = x1; return gcd;
}
ll modI(ll b, ll m)      {ll x, y; gcdEx(b, m, &x, &y); return (x % m + m) % m;}
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define MOD                 1000000007
#define modA(a,b)           (((a%MOD)+(b%MOD))%MOD)
#define modS(a,b)           (((((a%MOD)-(b%MOD))%MOD)<0)?(ll)(MOD+((a%MOD)-(b%MOD))%MOD):(ll)(((a%MOD)-(b%MOD))%MOD))
#define modM(a,b)           (ll)((((ll)(a%MOD))*((ll)(b%MOD)))%MOD)
#define modD(a,b)           ((modI(b,MOD)*(a%MOD))%MOD)
ll modP(ll x, ll y)         {
    ll r = 1; x %= MOD; while (y > 0) {
        if (y & 1) {r = (r * x) % MOD;}
        y = y >> 1; x = (x * x) % MOD;
    } return r;
}
ll max(ll a, ll b) {return (a > b ? a : b);}
ll min(ll a, ll b) {return (a < b ? a : b);}
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1 << " | "; __f(comma + 1, args...);
}
ll gcd( ll a, ll b )
{
    if (b == 0)
    {
        return a;
    }
    else
    {
        return gcd( b, (a % b) );
    }
}
ll lcm (ll a, ll b)
{
    ll ans = (a  / gcd(a, b)) * b;
    return ans;
}
void solve()
{
    ll ans = 0;
    ll n;
    cin >> n;
    vector<string> v(4);
    v[0] = "AC";
    v[1] = "WA";
    v[2] = "TLE";
    v[3] = "RE";
    map<string, int> m;

    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        m[s]++;
    }

    for (int i = 0; i < 4; i++)
    {
        cout << v[i] << " x " << m[v[i]] << "\n";
    }

    // cout << ans << "\n";
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t ;
    t = 1;
//   cin >> t;
    while (t--)
        solve();
    return 0;
}





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

int main() {
    string s;
    cin >> s;
    int sz = s.size();
    int remove_size = sz - 7;
    string ans = "NO";
    rep(i,8) {
        string lef = s.substr(0, i);
        string rig = s.substr(i+remove_size, sz-i-remove_size);
        if (lef + rig == "keyence") ans = "YES"; 
    }
    cout << ans << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  ll ans = 1000;
  rep(i,n-1) {
    if (a[i] <= a[i+1]) {
      ll s = ans / a[i];
      ans += (a[i+1] - a[i]) * s;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        int N = int.Parse(str[0]);
        long A = int.Parse(str[1]);
        long B = int.Parse(str[2]);
        long[] h = new long[N];
        for(int i=0;i<N;i++){
            h[i] = int.Parse(Console.ReadLine());
        }
        long bf = 0;
        long bl = 10000000000;
        while(bf != bl){
            long bc = (bf+bl)/2;
            bool b;
            {
                long count = 0;
                for(int i=0;i<N;i++){
                    if(h[i] > B*bc){
                        count += (h[i] - B*bc - 1)/(A-B)+1;
                    }
                }
                b = count <= bc;
            }
            if(b){
                bl = bc;
            }
            else{
                bf = bc+1;
            }
        }
        sb.Append(bf+"\n");
    }
}

Measured memory_bytes: 15836
n = int(input())
a = [int(x) for x in input().split()]
a.sort()

lim = pow(10, 6)+3
ans = 0
judge = [False]*(lim)
index = 0
for i in range(n):
  if judge[a[i]] == True:
    continue
  if i != n-1 and a[i] == a[i+1]:
    pass
  else:
    ans += 1
  for j in range(a[i], lim, a[i]):
    judge[j] = True
print(ans)

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

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

long long solve(vector<long long>& A) {
    int n = A.size();
    // cout << "A: " << A << endl;
    long long total = 0;
    long long prefix = 0;
    long long min_val = 1e18;
    for (auto a: A)
        total += a;
    for (auto a: A) {
        prefix += a;
        long long suffix = total - prefix;
        long long val = abs(suffix - prefix);
        min_val = min(min_val, val);
        // cout << "a: " << a << ", prefix: " << prefix << ", suffix: " << suffix << ", val: " << val << endl;
    }
    return min_val;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    vector<long long> A;
    cin >> n;
    A.resize(n);
    for (int i = 0; i < n; i++)
        cin >> A[i];
    long long ans = solve(A);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
char s[101000]; int l,ans;
int main(){
	cin>>s; ans=l=strlen(s);
	for (int i=1;i<l;++i) if (s[i]-s[i-1])
		ans=min(ans,max(i,l-i));
	cout<<ans;
}

Measured memory_bytes: 384
# coding: utf-8
'''
#シミュレーション
n=int(input())
a=list(map(int,input().split()))
ans=0
while True:
    for i in range(len(a)):
        if a[i]%2==0:
            a[i]//=2
        else:
            print(ans)
            exit()
    ans+=1
'''

#minとる
n=int(input())
ans=99999999
for x in map(int,input().split()):
    count=0
    while x%2==0:
        x//=2
        count+=1
    ans=min(ans,count)
print(ans)



Measured memory_bytes: 2940
#include<stdio.h> 
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int i, j, n, cnt = 0;
	scanf("%d", &n);
	if (n == 0){
		return 0;
	}
	vector<int>t(n);
	vector<int>h(n);
	for (i = 0; i < n; i++) {
		scanf("%d", &t[i]);
	}
	sort(t.begin(),t.end());
	for (i = 1; i <= 2 * n; i++){
		if (find(t.begin(), t.end(), i) == t.end()){
			h[cnt] = i;
			cnt++;
		}
	}
	int cn = t[0];
	t.erase(t.begin());
	while (true){
		for (i = 0; i < h.size() && cn>h[i]; i++);		
		if (i == h.size())cn = 0;
		else{
			cn = h[i]; h.erase(h.begin() + i);
		}
		if (h.empty())break;
		for (i = 0; i < t.size() && cn>t[i]; i++);
		if (i == t.size())cn = 0;
		else{
			cn = t[i]; t.erase(t.begin() + i);
		}
		if (t.empty())break;
	}
	printf("%d\n%d\n", h.size(), t.size());
	main();
}

Measured memory_bytes: 1060
<?php
$X = (int)fgets(STDIN);
$money = 100;
$i = 0;
if ($X === 100) {
    echo 0;
    return;
}
while (1) {
    $i += 1;
    $money = (int)($money * 1.01);
    if ($money >= $X) {
        echo $i;
        break;
    }
}

Measured memory_bytes: 16188
using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            string s = Console.ReadLine();
            string[] number = s.Split(' ');
            int[] numberList = number.Select(x => int.Parse(x)).ToArray();

            int[] sortList = numberList.OrderBy(x => x).ToArray();
            int flg = 0;
            for (int i = 0; i < number.Length; i++)
            {
                if (numberList[i] != sortList[i])
                {
                    flg++;
                }
            }

            if (flg == 0 || flg == 2)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


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

int w, h;
string s[51];
int dx[4] = {0,0,-1,1};
int dy[4] = {1,-1,0,0};

void debug(){
	cout << "[debug]" << endl;
	for(int y=0 ; y < h ; y++ ){
		cout << s[y] << endl;
	}
	cout << endl;
}

void solve(int x, int y, char c){
	if( c == 'w' ){
		for(int i=0 ; i < 4 ; i++ ){
			int mx = x + dx[i];
			int my = y + dy[i];
			if( mx < 0 || my < 0 || mx >= w || my >= h ) continue;
			if( s[my][mx] == '.' ){
				s[my][mx] = 'w';
				solve( mx , my , 'w' );
			}
		}
	}
	if( c == 'b' ){
		for(int i=0 ; i < 4 ; i++ ){
			int mx = x + dx[i];
			int my = y + dy[i];
			if( mx < 0 || my < 0 || mx >= w || my >= h ) continue;
			if( s[my][mx] == '.' ){
				s[my][mx] = 'b';
				solve( mx , my , 'b' );
			}else if( s[my][mx] == 'w' ){
				s[my][mx] = '?';
				solve( mx , my , '?' );
			}
		}
	}
	if( c == '?' ){
		for(int i=0 ; i < 4 ; i++ ){
			int mx = x + dx[i];
			int my = y + dy[i];
			if( mx < 0 || my < 0 || mx >= w || my >= h ) continue;
			if( s[my][mx] == '.' || s[my][mx] == 'w' || s[my][mx] == 'b' ){
				s[my][mx] = '?';
				solve( mx , my , '?' );
			}
		}
	}
}

int main(){
	while( cin >> w >> h, w || h ){
		for(int y=0 ; y < h  ; y++ ){
			cin >> s[y];
		}
		for(int y=0 ; y < h ; y++ ){
			for(int x=0 ; x < w ; x++ ){
				if( s[y][x] == 'W' ){
					solve( x , y , 'w' );
				}
			}
		}
		for(int y=0 ; y < h ; y++ ){
			for(int x=0 ; x < w ; x++ ){
				if( s[y][x] == 'B' ){
					solve( x , y , 'b' );
				}
			}
		}
		// debug();
		int white=0, black=0;
		for(int y=0 ; y < h ; y++ ){
			for(int x=0 ; x < w ; x++ ){
				if( s[y][x] == 'b' ) black++;
				if( s[y][x] == 'w' ) white++;
			}
		}
		cout << black << " " << white << endl;
	}
}

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

int main() {
  int a, b, x;
  cin >> a >> b >> x;
  if (x == a || (x > a && x <= (a+b))) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
    int H,W,K; cin>>H>>W>>K;
    vector<string> S(H);
    rep(i,H)cin>>S.at(i);

    int res = 0;
    for(int h = 0; h < (1<<H); h++){
        for(int w = 0; w < (1<<W); w++){
            int tmp = 0;
            rep(i,H)rep(j,W){
                if(h&(1<<i))continue;
                if(w&(1<<j))continue;
                if(S.at(i).at(j)=='#')tmp++;
            }
            if(tmp==K)res++;
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3616
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
ans = []
charctor_count = Counter(s)
max_count = max(charctor_count.values())
for k, v in charctor_count.items():
  if v == max_count:
    ans.append( k)
print("\n".join(sorted(ans)))

Measured memory_bytes: 38060
#include<stdio.h>

int main(void){

  int k,s;
  int i=0;
  int a, b, c;

  scanf("%d %d",&k,&s);

  for(a=0;a<=k && a<=s;a++){
    for(b=0;b<=k && a+b<=s;b++){
      if(s-a-b>=0 && s-a-b<=k){
        i++;
      }
    }
  }

  printf("%d\n",i);
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
long long p = 1000000007;
long long n, ans;
long long x[100001];
long long y[100001];
long long rui(long long rui_a, long long rui_b) {
	if (rui_b == 0)return 1;
	if (rui_b == 1)return rui_a % p;
	long long rui_c;
	rui_c = rui(rui_a, rui_b / 2);
	rui_c = rui_c * rui_c % p;
	if (rui_b % 2) {
		return rui_c * rui_a % p;
	}
	return rui_c;
}
int main() {
	scanf("%lld", &n);
	for (long long i = 1; i <= n; i++) {
		scanf("%lld", x + i);
	}
	y[1] = 1;
	for (long long i = 1; i < n; i++) {
		y[1] = (i * y[1]) % p;
	}
	for (long long i = 2; i < n; i++) {
		y[i] = y[1] * rui(i, p - 2) % p;
	}
	for (long long i = 1; i < n; i++) {
		ans += (((x[n] - x[i]) * y[i]) % p);
		ans = ans % p;
	}
	printf("%lld\n", ans % p);
}

Measured memory_bytes: 1664
from fractions import gcd
from functools import reduce

# input
N, X = map(int, input().split())
Xi_list = list(map(int, input().split()))
Xi_list.append(X)

Asc_Xi_list = sorted(Xi_list, reverse=True)

sa_list = []
for i in range(len(Asc_Xi_list)-1):
  sa_list.append(Asc_Xi_list[i] - Asc_Xi_list[i+1])

D = sa_list[0]
for i in range(1, len(sa_list)):
    D = gcd(D, sa_list[i])
    
print(D)

Measured memory_bytes: 16276
import Data.List

main :: IO ()
main = do
       [k,n] <- (map read . words) <$> getLine
       a <- (sort . map read . words) <$> getLine
       print $ solve k a
       
solve :: Int -> [Int] -> Int
solve k as = let space = sub (as ++ [(head as) + k]) 0
             in  k - space
               
sub :: [Int] -> Int -> Int
sub [] n      = n 
sub [x] n     = n
sub (x:xs) n  = sub xs $ max n (abs $ (head xs) - x )

Measured memory_bytes: 64236
N,M,c=map(int,input().split())
B = list(map(int,input().split()))
count=0
for n in range(N):
    A=list(map(int,input().split()))
    d=0
    for m in range(M):
        d+=A[m]*B[m]
    if d+c > 0:
        count += 1

print(count)


Measured memory_bytes: 3068
#include <iostream>
using namespace std;
int main(void){
    int a, b;
    
    string r = "No";
    cin >> a >> b;
    int turu = a;

    for (int turu = a; turu >= 0; turu--) {
        if ((turu * 2 + (a - turu) * 4) == b) r = "Yes";
    }
    cout << r;
}

Measured memory_bytes: 3628
# Union Find
# xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]


# xとyの属する集合の併合
def unite(x, y):
    x = find(x)
    y = find(y)

    if x == y:
        return False
    else:
        # sizeの大きいほうがx
        if par[x] > par[y]:
            x, y = y, x
        par[x] += par[y]
        par[y] = x
        return True


# xとyが同じ集合に属するかの判定
def same(x, y):
    return find(x) == find(y)


# xが属する集合の個数
def size(x):
    return -par[find(x)]


n, m = map(int, input().split())
# 初期化
# 根なら-size,子なら親の頂点
par = [-1] * n

for _ in range(m):
    a, b = map(int, input().split())
    unite(a - 1, b - 1)
print(len(list(filter(lambda x: x < 0, par))) - 1)

Measured memory_bytes: 10628
N, M = map(int, input().split())
H = list(map(int, input().split()))
A = [0]*M
B = [0]*M
for i in range(M):
    A[i], B[i] = map(int, input().split())
route = [[] for _ in range(N)]
for a, b in zip(A, B):
    route[a-1].append(b-1)
    route[b-1].append(a-1)
cnt = 0
for i in range(N):
    for r in set(route[i]):
        if H[i] <= H[r]:
            break
    else:
        cnt+=1
print(cnt)

Measured memory_bytes: 39964
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define LL long long
using namespace std;
LL n,k;
inline LL cal(LL u,LL m){
	LL d=u+m;
	if(u%m==0) return m*(u/m)*2;
	return cal(m,u%m)+2*m*(u/m)+(m-u%m);
}
int main(){
	scanf("%lld%lld",&n,&k);
	printf("%lld",cal(k,n-k)+k);
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    bool prev=false;
    int c=0;
    bool temp=false;
    while(n--)
    {
        int a,b;
        cin>>a>>b;
        if(a==b)
        {
            if(prev)
            {
                c++;
                if(c==3)
                {
                    temp=true;
                    break;
                }
            }
            else
            {
                prev=true;
                c=1;
            }
        }
        else
        {
            prev=false;
            c=0;
        }
    }
    if(temp)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define f first
#define s second
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	int a[n],ma=0,mi = INT_MAX;
	for(int i =0; i<n; i++)
	{
		cin>>a[i];
		ma = max(ma,a[i]);
		mi = min(mi,a[i]);
	}
	ll cost = INT_MAX,m=0;
	for(int i =mi; i<=ma; i++)
	{
		m=0;
		for(int j= 0;j<n; j++)
			m += pow(a[j]-i,2);
		cost = min(cost,m);
	}
	cout<<cost<<endl;
	return 0;
}

Measured memory_bytes: 256
class Point {
  constructor(x, y) {
    this.x = x;
    this.y = y;
  }

  print() {
    console.log(this.x.toFixed(8) + ' ' + this.y.toFixed(8));
  }
}

(function main(){
  const n = Number(require('fs').readFileSync('/dev/stdin', 'utf8').trim());
  let p1 = new Point(0, 0);
  let p2 = new Point(100, 0);
  p1.print();
  kock(n, p1, p2);
  p2.print();
})();

function kock(n, p1, p2) {
  const sin60 = Math.sin(60 * Math.PI / 180);
  const cos60 = Math.cos(60 * Math.PI / 180);
  function innerFunc(n, p1, p2) {
    if (!n) return;
    xDiff = p2.x - p1.x;
    yDiff = p2.y - p1.y;
    let s = new Point(p1.x + xDiff / 3, p1.y + yDiff / 3);
    let t = new Point(s.x + xDiff / 3, s.y + yDiff / 3);
    let u = new Point((t.x - s.x) * cos60 - (t.y - s.y) * sin60 + s.x,
        (t.x - s.x) * sin60 + (t.y - s.y) * cos60 + s.y);
    kock(n-1, p1, s);
    s.print();
    kock(n-1, s, u);
    u.print();
    kock(n-1, u, t);
    t.print();
    kock(n-1, t, p2);
  }
  kock = innerFunc;
  innerFunc(n, p1, p2);
}



Measured memory_bytes: 20192
#include <bits/stdc++.h> 
using namespace std;  
long INF=1000000000000000;
int main() {
    long N;
    cin>>N;
    vector<long> H(N);
    for(int i=0;i<N;i++) cin>>H.at(i);
    
    for(int i=N-1;i>0;i--){
        if(H.at(i-1)>H.at(i)+1){
            cout<<"No"<<endl;
            return 0;
        }else if(H.at(i-1)>H.at(i)) H.at(i-1)--;
    }
    
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
long long n;
long long gcd(long long a,long long b)
{
    if (!b) return a;
    return gcd(b,a%b);
}
void solve()
{
    if (n<=2) cout<<2;
    else cout<<2*n/gcd(2,n);
    cout<<endl;
}
int main()
{
    while(cin>>n)
        solve();
}

Measured memory_bytes: 764
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue> //priority_queue
#include <map>
#include <set> //multiset set<int,greater<int>>大到小
#include <vector>// ::iterator it;
#include <stack>
#include <cmath> // auto &Name : STLName  Name.
#include <utility>
#include <sstream>
#include <string>//__builtin_popcount(ans);//获取某个数二进制位1的个数
#define mod 1000000007
#define mod9 998244353
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
typedef long double ld;
const db eps=1e-10;
const int INF = 0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
#define rep(i,be,en) for (ll i=be;i<=en;i++)
#define per(i,be,en) for (int i=en;i>=be;i--)
//ll ksm(ll a,ll b,ll c){ll ans=1;a=a%c;while(b>0){if(b%2) ans=(ans*a)%c;b=b/2;a=(a*a)%c;}return ans;}
using namespace std;

const int N=5e5+7;
ll t,n,m,k,fl=0;

int main(){
    scanf("%lld",&n);
    rep(i,1,n){
        if(i%3==0) continue;
        if(i%5==0) continue;
        fl+=i;
    }
    printf("%lld\n",fl);

}

Measured memory_bytes: 3232
import sys


sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def bellman_ford(edges, n_nodes, start, goal):
    dist = [float("inf") for _ in range(n_nodes)]
    dist[start] = 0

    for i in range(2 * n_nodes):
        for fro, to, cost in edges:
            if dist[to] > dist[fro] + cost:
                dist[to] = dist[fro] + cost
                if i == n_nodes - 1:
                    dist[to] = -float("inf")

    return -dist[goal]


def main():
    N, M, P = map(int, input().split())
    edges = []
    for _ in range(M):
        a, b, c = map(int, input().split())
        edges.append((a - 1, b - 1, -c + P))

    ans = bellman_ford(edges, N, 0, N - 1)
    if ans == float("inf"):
        print(-1)
    else:
        print(max(ans, 0))


if __name__ == "__main__":
    main()


Measured memory_bytes: 43740
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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 N, C;
int s[100010], t[100010], c[100010];
int sm[200010], tt[200010];

int main() {
    cin >> N >> C;
    rep(i, N) cin >> s[i] >> t[i] >> c[i];
    for (int i = 1; i <= C; i++) {
        for (int j = 0; j < 200010; j++) tt[j] = 0;
        for (int j = 0; j < N; j++) {
            if (c[j] == i) tt[s[j]*2-1]++, tt[t[j]*2]--;
        }
        for (int j = 1; j < 200010; j++) tt[j] += tt[j-1];
        for (int j = 0; j < 200010; j++) if (tt[j] > 0) sm[j]++;
    }

    int ans = 0;
    rep(i, 200010) chmax(ans, sm[i]);
    cout << ans << endl;
}


Measured memory_bytes: 2944
#include<iostream>
#define EPS 10e-9
using namespace std;
int main()
{
	double xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2;
	while(cin>>xa1>>ya1>>xa2>>ya2>>xb1>>yb1>>xb2>>yb2)
	{
		if(max(xb1,xb2)>=min(xa1,xa2)&&min(xb1,xb2)<=max(xa1,xa2)&&max(yb1,yb2)>=min(ya1,ya2)&&min(yb1,yb2)<=max(ya1,ya2)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;

	}
  return 0;
}

Measured memory_bytes: 1216
#include<stdio.h>
int main()
{
	int n;
	int C[500],S[500],F[500];
	int	time[500]; 
	int i,j;
	while(scanf("%d",&n)!=-1)
	{
		for(i=0;i<n-1;i++)
		{
			scanf("%d%d%d",&C[i],&S[i],&F[i]);
			time[i]=S[i];									//全复制等车 
		}
		for(i=0;i<n-1;i++)									//第n个。。最后一个为零，不用管了 
		{
			for(j=i;j<n-1;j++)
			{
				while(!(time[i]%F[j]==0)||time[i]<S[j]) 
				{
					time[i]++;
				}
				time[i]+=C[j];
				
			}
		}
		for(i=0;i<n-1;i++)
		{
			printf("%d\n",time[i]);
		}
		printf("%d\n",0);						//打印 
	}
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair<lo,lo> ll;//pair
typedef vector<lo> vl;  //vector of long
typedef vector<ll > vll;   //vector of pair
typedef priority_queue<lo>p_q;
#define mp(a,b) make_pair((a),(b))
#define REP(a,b) for(lo i=(a);i<(b);i++)//no need to declare variable i
#define REPE(a,b,c,d) REP(a,b)for(lo j=(c);j<(d);j++)//no need to declare vaiables i,j
#define REPV(a,b,c) for((a)=b;(a)<(c);(a)++)//a is the variable
#define IREP(a,b) for(lo i=(a);i>=(b);i--)
#define IREPV(a,b,c) for((a)=b;(a)>=(c);(a)--)
#define all(v) (v).begin(),(v).end()
#define TRvl(c) for (vl::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvll(c) for (vll::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000
#define gc getchar_unlocked
#define pc putchar_unlocked
#define pb(a) push_back((a))


vector <vll> g(100000);
  vll edges;
      vl visited(100000,0);
void dfs(lo node,lo c,lo maxi){
    if(visited[node]==0){
        visited[node]=1;

        REP(0,g[node].size()){
                if(!visited[g[node][i].first]){
                    g[node][i].second=(c)%maxi;
                   // cout<<node<<" "<<g[node][i].first<<" "<<g[node][i].second<<endl;
                    c++;
                    dfs(g[node][i].first, c,  maxi);

                }

        }
    }
}


int main(){
  lo m;
  cin>>m;
lo c=0;

  lo a,b;
  lo k=m-1;
  while(k--){
    cin>>a>>b;
    a--;b--;
    g[a].pb(mp(b,0));
    g[b].pb(mp(a,0));
    edges.pb(mp(a,b));
  }
  lo maxi=0;
  REP(0,m){
    if(g[i].size()>maxi)
        maxi=g[i].size();
  }
    //lo c=0;
    dfs(0,c,maxi);
    cout<<maxi<<endl;

   // cout<<endl;
    REP(0,edges.size()){
        a=edges[i].first;
        b=edges[i].second;
        for(lo j=0;j<g[a].size();j++){
            if(g[a][j].first==b){
                cout<<g[a][j].second+1<<endl;
                break;
            }
        }
    }
  return 0;

}


Measured memory_bytes: 12148
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
//S.size()
//配列名.Length()
using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;


int main(void){
	string s;cin>>s;
	for(int i = 0; i < s.size(); i += 2){
		cout<<s[i];
	}
}


Measured memory_bytes: 512
n=int(input())
lst=[[[0]*10 for i in range(0,3)] for j in range(0,4)]
for k in range(n):
    b,f,r,v = map(int,input().split())
    lst[b-1][f-1][r-1] +=v
x=0
for i in range (4):
    if x!=0: print("#"*20)
    x+=1
    for a in range(3):
        for b in range(10):
            print(" %d"%(lst[i][a][b]),end="")
        print()


Measured memory_bytes: 5624
N, K = map(int, input().split())
A = list(map(int, input().split()))
 
t = 0
now = 1
footprint = [1]
past = [0]*N
past[0] = 1

while t < K:
  if past[A[now-1]-1] == 0:
    now = A[now-1]
    footprint.append(now)
    past[now-1]=1
    t += 1
  else:
    s = footprint.index(A[now-1])
    l = t - s + 1
    e = (K-s) % l
    now = footprint[s+e]
    break
    
print(now)

Measured memory_bytes: 32372
#include<stdio.h>
int main()
{
    long long int num1, num2, rem, n1, n2, GCD, LCD;
    while(scanf("%lld%lld", &num1, &num2)!=EOF){
        if(num1>=num2){
            n1=num1;
            n2=num2;
        }
        else{
            n2=num1;
            n1=num2;
        }
        while(n2!=0){
            rem=n1%n2;
            n1=n2;
            n2=rem;
        }
        GCD=n1;
        LCD=(num1*num2)/GCD;
        printf("%lld %lld\n", GCD, LCD);

    }
    return 0;
}

Measured memory_bytes: 1684
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<deque>
#include<cctype>
#include<cstdlib>
#include<cstring>
using namespace std;
int read()
{
    char tmp;
    int f(1),x(0);
    for(tmp=getchar();!isdigit(tmp);tmp=getchar()) if(tmp=='-') f=-1;
    for(;isdigit(tmp);tmp=getchar()) x=x*10+tmp-'0';
    return f*x;
}
deque<int> dq;
int tmp,dis[100000],k;
bool visited[100000];
int main()
{
    memset(dis,0x7F,sizeof(dis));
    dis[1]=0; 
    k=read();
    dq.push_back(1);
    while(!dq.empty())
    {
        tmp=dq.front(); dq.pop_front();
        if(tmp==0)
            break;
        if(visited[tmp])
            continue;
        visited[tmp]=true;
        if(dis[(tmp*10)%k]>dis[tmp])
        {
            dis[(tmp*10)%k]=dis[tmp];
            dq.push_front((tmp*10)%k);
        }
        if(dis[(tmp+1)%k]>dis[tmp]+1)
        {
            dis[(tmp+1)%k]=dis[tmp]+1;
            dq.push_back((tmp+1)%k);
        }
    } 
    printf("%d",dis[0]+1);
    return 0;
}

Measured memory_bytes: 896
#include <iostream>

using namespace std;

int main() {

    int N;
    scanf("%d", &N);

    int C[N - 1], S[N - 1], F[N - 1];
    for (int i = 0; i < N - 1; ++i) {
        scanf("%d %d %d", &C[i], &S[i], &F[i]);
    }

    int A[N - 1];
    for (int j = 0; j < N - 1; ++j) {
        for (int i = j; i < N - 1; ++i) {
            if (i == j) {
                A[j] = S[i] + C[i];
            } else {
                if (A[j] < S[i]) A[j] = S[i] + C[i];
                else if (A[j] % F[i] == 0) A[j] = A[j] + C[i];
                else A[j] = A[j] + (F[i] - A[j] % F[i] + C[i]);
            }
        }
    }

    for (int i = 0; i < N - 1; ++i) {
        printf("%d\n", A[i]);
    }
    printf("0\n");

    return 0;
}


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

public class Main {
    private void solve() {
        int n = sc.nextInt();
        int m = sc.nextInt();

        List<List<Integer>> g = new ArrayList<>();
        for (int i = 0; i <= n; i++) {
            g.add(new ArrayList<>());
        }
        for (int i = 0; i < m; i++) {
            int u = sc.nextInt();
            int v = sc.nextInt();
            g.get(u).add(v);
            g.get(v).add(u);
        }

        boolean[] vis = new boolean[n + 1];
        Queue<Integer> q = new ArrayDeque<>();
        q.add(1);
        vis[1] = true;
        int[] ans = new int[n + 1];
        while (!q.isEmpty()) {
            int u = q.poll();
            for (int v : g.get(u)) {
                if (!vis[v]) {
                    ans[v] = u;
                    vis[v] = true;
                    q.add(v);
                }
            }
        }

        boolean ok = true;
        for (int u = 2; u <= n; ++u) {
            if (ans[u] == 0) {
                ok = false;
                break;
            }
        }

        if (ok) {
            out.println("Yes");
            for (int u = 2; u <= n; ++u) {
                out.println(ans[u]);
            }
        } else {
            out.println("No");
        }
    }

    private static PrintWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

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

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

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

    public static void main(String[] args) {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().solve();
        out.close();
    }
}


Measured memory_bytes: 69568
#include <bits/stdc++.h>
using namespace std;
/**
*   @Author: MeGaaaaaaaaaa
*   @InitTime: Mon Sep 09 05:03:34 2019
*   @Idea: 
*
*
*
*
* Happy Solving :)
**/
int main(){
#ifndef ONLINE_JUDGE
 //   freopen("in","r",stdin)
 //   freopen("out","w",stdout)
#endif
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    int answer=0;
    if(2*c <= b+a){
       int f=min(x,y);
       answer=f*(2*c);
       x-=f;
       y-=f;
    //   cout<<answer<<endl;
       if(x!=0){
       	  answer+=min((int)((x)*(2*c)),(int)(x*a));
       }
       if(y!=0){
       	  answer+=min((int)(y)*(2*c),(int)(y*b));
       }
   }else{
        answer=a*x+y*b;
   }
   cout<<answer<<endl;






}


Measured memory_bytes: 256
#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;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	string str;
	cin >> str;
	string check = "CF";
	int checkcnt = 0;
	for (auto&& i : str) {
		if (check[checkcnt] == i) {
			checkcnt++;
			if (checkcnt == 2) {
				cout << "Yes\n";
				return;
			}
		}
	}
	cout << "No\n";
}

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


Measured memory_bytes: 256
def resolve():
    n = int(input())
    v = sorted(list(map(int, input().split())))
    while len(v) > 2:
        new_v = [sum(v[:2]) / 2] + v[2:]
        v = new_v
    print(sum(v) / 2)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 38256
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: usize,
    }
    let mut current_str = 0;
    let mut max_str = 0;
    for i in 0..n {
        input! {
            d1: u32,
            d2: u32,
        }
        if d1 == d2 {
            current_str += 1;
            max_str = max_str.max(current_str);
        } else {
            current_str = 0;
        }
    }
    if max_str >= 3 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2176
#include <stdio.h>

int main(void){
  int n, t, i, c, ti, min;
  scanf("%d%d\n", &n, &t);

  min = 1001;

  for(i = 0; i < n; i++){
	scanf("%d%d", &c, &ti);
	if(ti <= t && c < min){
	  min = c;
	}
  }

  if(min == 1001){
	printf("TLE\n");
  }else {
	printf("%d\n", min);
  }
   
  return 0;
}


Measured memory_bytes: 128
/* 165-B.cpp
 *     Created on : May 2, 2020 
 *     Time       : 6:18:34 PM
 *     Author     : null_ptr
 */
#include<iostream>
#include<cmath>

using namespace std;

int main()
{
	long long x;
	cin>>x;
	long long curr=100;
	int ans=0;
	while(curr<x)
	{
		ans++;
		curr+=floor((curr/100.0));
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 3636
int main() {
	int c1=0,c5=0,c10=0,c50=0,c100=0,c500=0;
	scanf("%d%d%d%d%d%d",&c1,&c5,&c10,&c50,&c100,&c500);
	if ((c1+c5*5+c10*10+c50*50+c100*100+c500*500)>=1000)
	{
		printf("1\n");
	}
	else
	{
		printf("0\n");
	}
	return 0;
}


Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
 
#define vi vector<int>
#define ll long long
#define ld long double
#define vvi vector<vi>
#define vll vector<ll>
#define vld vector<ld>
#define vvll vector<vll>
#define vvld vector<vld>
#define MOD 1000000007
#define endL << '\n'
#define ii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define mp make_pair
#define endL << '\n'
#define vii vector<ii>
#define pb push_back

/*
ll powmod(ll x, ll y, ll mod){
	ll res = 1;
	while (y > 0){
		if (y%2) res = (res*x) % mod;
		x = (x*x) % mod;
		y /= 2;
	}
	return res;
}
*/

/*const int N = 1000000;
int lp[N+1];
vector<ll> pr;

void sieve(){
	for (int i=2; i<=N; ++i) {
	    if (lp[i] == 0) {
	        lp[i] = i;
	        pr.push_back (i);
	    }
	    for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
	        lp[i * pr[j]] = pr[j];
	}
}*/

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1; //cin >> t;
	while(t--){
		int n; cin >> n;
		ld p;
		vvld dp(n, vld(n*2 + 1, 0));
		int up, down;
		cin >> p; dp[0][n-1] = p; dp[0][n+1] = 1-p;
		//for (auto prob : dp[0]) cout << prob << " "; cout endL;
		
		for (int i = 2; i <= n; i++){
			cin >> p;
			for (int j = n-i; j <= n+i; j++){
				up = j-1; down = j+1;
				if (up >= n - (i-1)) dp[i-1][j] = (dp[i-2][up] * (1-p));
				if (down <= n + (i-1)) dp[i-1][j] += (dp[i-2][down] * p);
			}
		}
		ld ans = 0;
		for (int j = 0; j < n; j++) ans += dp[n-1][j];
		cout << fixed << setprecision(10) << ans endL;
	}
}

Measured memory_bytes: 281600
#include <bits/stdc++.h>
#define N 500003
#define MOD 1000000007
using namespace std;


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

    }
    int dp[n]={0};
    for(int i=1;i<n;i++){
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),(i-2>=0)?dp[i-2]+abs(a[i]-a[i-2]):MOD);
    }
    cout<<dp[n-1]<<endl;


}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <map>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline bool Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+" ";
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
constexpr const ll INF = 1e15;
constexpr const ll MOD = 1000000007;
constexpr int nx[4] = {1,0,-1,0};
constexpr int ny[4] = {0,1,0,-1};
typedef pair<ll,ll> P;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,t;
    cin >> n >> t;
    vector<ll> a(n),l(n,INF),r(n,0);
    cins(all(a));
    l[0] = a[0];
    r[n-1] = a[n-1];
    rep(i,n-1){
        l[i+1] = min(l[i],a[i+1]);
        r[n-i-2] = max(r[n-i-1],a[n-i-2]);
    }
    ll max = 0;
    rep(i,n-1) chmax(max,r[i+1]-l[i]);
    ll ans = 0;
    map<ll,bool> done;
    rep(i,n-1){
        if (r[i+1]-l[i] == max && done[r[i+1]] == 0){
            ans++;
            done[r[i+1]] = 1;
        }
    }
    PRINT(ans);
}


Measured memory_bytes: 5760
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for ( int i=1; i<=int(n); i++ )  
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;
typedef pair<int, int> pii;
typedef long double LD;
const int INF = 0x3f3f3f3f;

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
		if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}


int main() {
    string s;
    cin >> s;
    for(int i =  0; i < SZ(s); i ++) 
        if(s[i] == 'A' && i + 1 < SZ(s) && s[i + 1] == 'C') {
            return puts("Yes"), 0;
        }
    puts("No");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back
#define pp pair<int,int>
#define rep(i,l,r) for(int i=l;i<r;i++)
int main()
{
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt.txt","r",stdin);
    // freopen("output.txt.txt","w",stdout);
    // #endif
    int n,k;
    cin>>n>>k;
    vi a(n);
    rep(i,0,n) cin>>a[i];
    vector<bool> dp(k+1);
    int minval = *min_element(all(a));
    rep(i,0,minval) dp[i] = false;
    rep(i,minval,k+1)
    {
        dp[i] = false;
        rep(j,0,n)
        {
            if(i>=a[j] and dp[i-a[j]]==false)
            {
                dp[i] = true;
                break;

            }

        }
    }
    if(dp[k])
    {
        cout<<"First\n";
    }
    else
    {
        cout<<"Second\n";
    }


 
}

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

int main(int argc,char** argv)
{


	int n,l;
	cin >> n >> l;
	string a[n];


	for(int i = 0; i < n; i++){
		cin >> a[i];
	}

	sort(a, a+n);

	for(int i = 0; i < n; i++){
		cout << a[i] ;
	}

	cout << '\n';
	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    string N;
    cin >> N;
    int ans = 0;
    for (char c : N)
    {
        ans += c - '0';
    }

    if (N.length() >= 2)
    {
        const int tmp = ((N[0] - '0') - 1) + 9 * (N.length() - 1);
        chmax(ans, tmp);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
abcd = input()
bit = 0b1000
ans=int(abcd[0])
op = [-1,-1,-1]
str_bit = bin(bit)

while bit<16:
  for i in range(3,6):
    if str_bit[i]=="1":op[i-3]=1
    else:op[i-3]=0

  for i in range(0,3):
    if op[i]==1:
      ans+=int(abcd[i+1])
    else:
      ans-=int(abcd[i+1])
  
  if ans==7:
    for i in range(len(op)):
      if op[i]==1:
        op[i]="+"
      else:
        op[i]="-"
    print(abcd[0],op[0],abcd[1],op[1],abcd[2],op[2],abcd[3],"=7",sep='')
    exit()
  
  ans=int(abcd[0])
  bit+=1
  str_bit=bin(bit)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>

using namespace std;
using PII = pair<int, int>;

int main() {
	int n, m;
	cin >> n >> m;

	int a, b, c;
	priority_queue<PII> que;

	for (int i = 0; i < n; i++) {
		cin >> a;
		que.push(make_pair(a, 1));
	}
	for (int i = 0; i < m; i++) {
		cin >> b >> c;
		que.push(make_pair(c, b));
	}

	long long ans = 0;
	int n_card = 0;

	while (n_card < n) {
		auto p = que.top();
		que.pop();

		int tmp = min(n - n_card, p.second);
		ans += 1LL * tmp * p.first;
		n_card += tmp;
	}

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


Measured memory_bytes: 2420
import math
A,B,H,M = map(int, input().split())

M_deg = M * 6
H_deg = H * 30 + M * 0.5
angle = abs(M_deg-H_deg)

cos_angle = math.cos(math.radians(angle))

ans =math.sqrt(( A*A) + (B*B) - (2*A*B*cos_angle))

print(ans)





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

int main() {
	int N , K ;
    int x;
    int sum = 0;
    cin >> N >> K;
    for(int i = 0; i < N; i++){
    	cin >> x;
        if(2 * x < 2 * (K - x)){
        	sum += 2 * x;
        }else{
        	sum += 2 * (K - x);
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007


int main(){
    int i,j;
    string s;

    cin>>s;

    string t="2019/04/30";

    if(s<=t) cout<<"Heisei"<<endl;
    else cout<<"TBD"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<list>
#include<vector>
#include<climits>
#include<string>
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
int main()
{
  fast_io();
  int a;
  string s;
  cin>>a>>s;
  if(a>=3200)cout<<s;
  else cout<<"red";
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc098/tasks/arc098_b
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


class CumSum1d:
    def __init__(self, ls: list):
        '''
        1次元リストを受け取る
        '''
        from itertools import accumulate
        self.ls_accum = [0] + list(accumulate(ls))

    def total(self, i, j):
        # もとの配列lsにおける[i,j)の中合計
        return self.ls_accum[j] - self.ls_accum[i]


class CumXor1d:
    def __init__(self, ls: list):
        '''
        1次元リストを受け取る
        '''
        self.ls_accum = [0]
        for l in ls:
            self.ls_accum.append(l ^ self.ls_accum[-1])

    def total(self, i, j):
        # もとの配列lsにおける[i,j)の中合計
        return self.ls_accum[j] ^ self.ls_accum[i]


from collections import deque
N = int(input())
A = read_ints()

# どの[ii,jj)を持ってきてもxorsumとaddsumが成り立つ最長の区間[i,j)に対してn=j-iに対してn * (n - 1) // 2 + n をすれば良い ? いや若干ダブりが存在して微妙に合わない
# 一旦最長の区間のidxを取得してダブリの区間はその後に考慮しよう?
# 前処理としてxorとadd両方の累積xorと累積和を作ってあげる
# でi,jを尺取法などで取得すれば良い

cumsum = CumSum1d(A)
cumxor = CumXor1d(A)
# 尺取法でaddとxorした区間和が一致する一番長い[i,j)を取ってくる
ids = []
r_pre = 0
for l in range(0, N):
    r = max(r_pre, l + 1)  # ありえるidxに
    while r <= N and cumsum.total(l, r) == cumxor.total(l, r):
        r += 1  # totalのrはすでに半開区間 それを満たさなくなったときのrとしたら半開区間の更にその先に行く
    r -= 1  # 行き過ぎた分を調整
    if r != r_pre:
        r_pre = r
        ids.append((l, r))


ans = 0
for l, r in ids:
    n = r - l
    ans += n + n * (n - 1) // 2
# さらにダブっている部分を取り除く
if len(ids) > 1:
    for (_, r), (l, _) in zip(ids, ids[1:]):
        n = max(0, r - l)
        ans -= n + n * (n - 1) // 2


print(ans)


Measured memory_bytes: 90356
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

int		main(void)
{
	int n;
	cin >> n;

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



Measured memory_bytes: 3628