akhauriyash/Code-Regression huggingface dataset:
n = int(input())
s= list(input().split())
for i in range(n):
    s[i] = int(s[i])

count = 0
for i in range(1,n-1):
    if (s[i-1] < s[i] and s[i] < s[i+1]) or(s[i+1] < s[i] and s[i] < s[i-1]):
        count += 1

print(count)


Measured memory_bytes: 3060
#include <iostream>
#define ll long long
using namespace std;

int main() {
  ll n, a, b, c, d;
  string m;
  cin >> n >> a >> b >> c >> d;
  cin >> m;
  a--;
  b--;
  c--;
  d--;
  for (int i = a; i < c; i++){
    if (m[i] == '#' && m[i+1] == '#'){
      cout << "No" << endl;
      return 0;
    }
  }

  for (int i = b; i < d; i++){
    if (m[i] == '#' && m[i+1] == '#'){
      cout << "No" << endl;
      return 0;
    }
  }

  if ( d < c){
    for (int i = b; i <= d; i++){
      if (m[i] == '.' && m[i-1] == '.' && m[i+1] == '.'){
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
  }
  else 
    cout << "Yes" << endl;

  return 0;
}

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

int main() {
  long n,ans=0,max_l=0;
  cin >> n;
  vector<long> l(n);
  vector<long> aaa(1000);
  vector<long> c_sum(1001);
  for(int i=0;i<n;i++) {
    cin >> l.at(i);
    aaa.at(l.at(i)-1)++;
    max_l=max(max_l,l.at(i));
  };
  c_sum.at(0)=0;
  for(int i=1;i<1001;i++) {
    c_sum.at(i)=c_sum.at(i-1)+aaa.at(i-1);
  };
  
  for(int i=max_l;i>0;i--) {
    if(aaa.at(i-1)==0) continue;
    for(int j=i;j*2>i;j--) {
      if(aaa.at(j-1)==0) continue;
      if(i==j) {
        ans+=aaa.at(i-1)*(aaa.at(j-1)-1)*(c_sum.at(j-1)-c_sum.at(i-j))/2;
        ans+=aaa.at(i-1)*(aaa.at(i-1)-1)*(aaa.at(i-1)-2)/6;
      } else {
        ans+=aaa.at(i-1)*aaa.at(j-1)*(c_sum.at(j-1)-c_sum.at(i-j));
        ans+=aaa.at(i-1)*aaa.at(j-1)*(aaa.at(j-1)-1)/2;
      };
    };
  };
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
typedef long long ll;

int W[110];
int V[110];

int main()
{
  int n, w;
  cin >> n >> w;
  for (int i = 1; i <= n; i++)
  {
    cin >> W[i] >> V[i];
  }

  vector<ll> dp(w + 1, 0);
  for (int i = 1; i <= n; i++)
  {
    for (int j = w; j - W[i] >= 0; j--)
    {
      dp[j] = max(dp[j], dp[j - W[i]] + V[i]);
    }
  }
  ll ans = 0;
  rep(j, w + 1) ans = max(ans, dp[j]);
  cout << ans << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

int main(){
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    S[K-1] = S[K-1] + 0x20;
    cout << S << endl;
    return 0;
}


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


def read():
    T = list(input().strip())
    return T,


def solve(T):
    N = len(T)
    ans = 0
    for i in range(N):
        if T[i] == "?":
            T[i] = "D"
        if T[i] == "D":
            ans += 1
    T = "".join(T)
    return T


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


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

struct Rectangle
{
	int h;
	int w;
};

int main(){
	vector<Rectangle> nums;
	Rectangle rec;
	int i,j,k;
	while(cin>>rec.h>>rec.w){
		if(rec.h==0 && rec.w==0) break;
		nums.push_back(rec);
	}
	for(i=0; i<nums.size(); i++){
		for(j=0; j<nums[i].h; j++){
			for(k=0; k<nums[i].w; k++){
				if(j==0 || j==nums[i].h-1){
					cout<<"#";
				}else{
					if(k==0 || k==nums[i].w-1){
						cout<<"#";
					}else{
						cout<<".";
					}
				}
			}
			cout<<"\n";
		}
		cout<<"\n";
	}
	return 0;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j;
  ll n,k; cin>>n>>k;
  //ll a,b,c,d,e,f; cin>>a>>b;
  //string a,b,c,d,e,f; cin>>a>>b>>c;
  //ll a,b,c,d,e,f; cin>>a>>b>>c>>d;
  //string s; cin >> s;
  ll result = 0;
  ll buf = 0;
  bool judge = true;
  for(i=k+1;i<=n;i++){
    result+=(n/i)*(i-k);
    if(k==0) result+=n%i;
    else result+=max(buf,n%i-k+1);
    //cout<<i spa result << endl;
  }
  cout << result << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define f first
#define s second
using namespace std;


int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    string str; cin >> str;
    int count = 0;
    bool found = false;
    int res = 0;
    for(int i=0;i<3;++i){
        if(str[i] == 'R'){
            count++;
            found = true;
        }
        else{
            count = 0;
        }
        res = max(count, res);
    }
    cout << res << '\n';
    return 0;
}

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

char S[5];

int main(){
  rep(i, 3) cin >> S[i];
  if (S[1] == 'B') cout << "ARC" << endl;
  else cout << "ABC" << endl;
}


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

int main() {
	long n,b=1,c=0;
	cin>>n;
	long a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n-1;i++){
		if(a[i]==a[i+1]){
			b++;
			if(i==(n-2)){
				c+=(b/2);
			}
		}
		else{
			c+=(b/2);
			b=1;
		}
	}
	cout<<c<<endl;
	
	return 0;
}

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

int N, A, B, C;
int l[10];
int INF = 1000000000;

int three_min(int x, int y, int z){
	return min(min(x, y), z);
}
int four_min(int x, int y, int z, int w){
	return min(min(min(x, y), z), w);
} 

int dfs(int cur, int a, int b, int c){
	if(cur == N){
		if(three_min(a, b, c) > 0) return abs(A - a) + abs(B - b) + abs(C - c) - 30;
		else return INF;
	}else{
		int A_in = dfs(cur + 1, a + l[cur], b, c) + 10;
		int B_in = dfs(cur + 1, a, b + l[cur], c) + 10;
		int C_in = dfs(cur + 1, a, b, c + l[cur]) + 10;
		int Not_in = dfs(cur + 1, a, b, c);
		return four_min(A_in, B_in, C_in, Not_in);
	}
}

int main() {
    cin >> N >> A >> B >> C;
    for (int i = 0; i < N; ++i) cin >> l[i];

	cout << dfs(0, 0, 0, 0) << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);

        int n = stdIn.nextInt();
        int[] dp = new int[n+1];

        dp[0] = 1;
        dp[1] = 1;
        for(int i=2; i<=n; i++){
            dp[i] = dp[i-1] + dp[i-2];
        }

        System.out.println(dp[n]);
    }
}


Measured memory_bytes: 26104
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define forn(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define mp make_pair

int main()
{
	string s; cin >> s; int count = 0; int ma = 0;
	forn(i,0,3)
	{
		count = 0;
		if(s[i] == 'R')
		{
			count++;
			if(i+1 < 3)
			{
				if(s[i+1] == 'R')
				{
					count++;

					if(i+2 < 3)
					{
						if(s[i+2] == 'R')
							count++;
					}
				}
			}
		}

		ma = max(ma,count);
	}

	cout << ma << endl;
}

Measured memory_bytes: 3628
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def M(n): return ModInt(n)
def MI(): return M(I())


def main():
    return collections.Counter(S())['1']



print(main())




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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;


void solve(){

    int n;
    cin >> n;
    ll k;
    cin >> k;

    vi a(n, 0);
    int tmp;
    rep(i,0,n){
        cin >> tmp;
        a[i] = tmp-1;
    }

    vi isVisited(n, -1);
    int cnt = 0, s = 0;
    while(1){
        if(isVisited[s] != -1) break;
        isVisited[s]=cnt;
        ++cnt;
        s=a[s];
    }

    int cycle = cnt-isVisited[s];
    if(k > isVisited[s]+cycle){
        k -= isVisited[s];
        k = (k+cycle)%cycle+isVisited[s];
    }

    s=0;
    while(k--){
        s=a[s];
    }

    cout << s+1 << "\n";

    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

    fast_io;
    int t=1;
    // cin >> t;

    while(t--){
        solve();
    }

    cpuTime();
return 0;
}


Measured memory_bytes: 4752
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sc(x) scanf("%lld",&x);
int A[105];
signed main()
{
    int N,K;
    sc(N)
    for(int i=1;i<=N;i++)sc(A[i])
    int t,ans = 1e18;
    for(int i=1;i<=100;i++){t=0;
        for(int j=1;j<=N;j++){
            t+=(i-A[j])*(i-A[j]);
        }
        ans = min(ans,t);
    }
    cout<<ans<<'\n';
}


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

#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ll long long
#define ld long double
#define pb push_back
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define LDMX LDBL_MAX
#define LDMN LDBL_MIN
#define MAX 1000000

ll mulmod(ll, ll);
ll fastpower(ll, ll);
void getprime(vector<ll>&);
void getfact(vector<ll>&, vector<ll>&);
ll ncr(ll, ll, vector<ll>&, vector<ll>&);

void solve()
{
    ll n, k = 0;
    string s;
    cin>>n>>s;
    for(int i=0;i<n-2;i++)
    {
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C')
            k++;
    }
    cout<<k;
}

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

ll mulmod(ll a, ll b)
{
    ll res = 0; 
    a = a % MOD;
    while(b > 0)
    {
        if (b % 2 == 1)
            res = (res + a) % MOD;
 
        a = (a * 2) % MOD; 
        b /= 2;
    } 
    return res % MOD; 
}

ll  fastpower(ll a, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n % 2 != 0)
        {
            res = (res * a) % MOD;
        }
        n /= 2;
        a = (a * a) % MOD;
    }
    return res;
}

void getprime(vector<bool>&prime)
{
    prime[0] = false;
    prime[1] = false;
    
    for(ll i = 2;i <= MAX; i++)
    {
        if(prime[i])
        {
            for(ll j = i*i; j <= MAX; j += i)
                prime[j] = false;
        }
    }
}

void getfact(vector<ll> &fact, vector<ll> &ifact)
{
    fact[0] = 1;
    ifact[0] = 1;
    
    for(ll i = 1; i <= MAX; i++)
    {
        fact[i] = (fact[i-1] * i)%MOD;
        ifact[i] = (ifact[i-1] * fastpower(i, MOD -2) )%MOD;
    }
}

ll ncr(ll n, ll r, vector<ll>&fact, vector<ll>&ifact)
{
    ll res;
    res = (((fact[n] * ifact[r]) % MOD) * ifact[n-r]) % MOD;
    return res;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s: String = read();
    let p = ["dreameraser", "dreamerase", "dreamer", "dream", "eraser", "erase"];

    let mut u: String = String::from(s.to_string());
    let mut t: String = "".to_string();

    let mut ans = None;

    'outer: loop {
        for x in p.into_iter() {
            let i = match u.find(x) {
                None => continue,
                Some(i) => i,
            };
            if i != 0 {
                continue
            }
            t = format!("{}{}", t, x);
            u = u[x.to_string().len()..u.len()].to_string();
            if s == t {
                ans = Some("YES");
                break 'outer;
            }
            continue 'outer;
        }
        break
    }
    println!("{}", ans.unwrap_or("NO"));
}


Measured memory_bytes: 6396
#include <bits/stdc++.h> 
#include <chrono>
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

int main(){
    LL N,M,K;
    cin>>N>>M>>K;
    vector<LL>Asum(N+1,0),Bsum(M,0);
    REP(i,N){
        LL A;cin>>A;
        Asum[i+1]+=(Asum[i]+A);
    }
    REP(i,M){
        LL B;cin>>B;
        if(i==0)Bsum[i]=B;
        else Bsum[i]+=(Bsum[i-1]+B);
    }
    LL res=0;
    for(LL resA=0;resA<=N;resA++){
        if(Asum[resA]>K)break;
        auto it=upper_bound(Bsum.begin(), Bsum.end(), K-Asum[resA]);
        size_t pos = distance(Bsum.begin(), it);
        res=max(res,resA+(LL)pos);
        //cout<<resA<<" "<<Asum[resA]<<" "<<res<<endl;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 6432
import array
import itertools


def sieve_of_eratosthenes(end, typecode="L"):
    assert end > 1
    # 整数iが素数であるかをis_prime[i]が示す
    # 最初はすべてTrueで初期化しておく
    # 最終的にprimesではなくこれを返してもよい
    is_prime = array.array("B", (True for i in range(end)))
    # 0, 1はいずれも素数ではない
    is_prime[0] = False
    is_prime[1] = False
    # 素数を格納する配列
    primes = array.array(typecode)
    # 篩う
    for i in range(2, end):
        if is_prime[i]:  # iが素数であるとき
            primes.append(i)  # 素数の配列に加える
            for j in range(2 * i, end, i):  # iを超えるiの倍数について
                is_prime[j] = False  # 素数ではないため除外する
    return primes

primes = sieve_of_eratosthenes(55555)


n = int(input())
ret = []
count = 0
for _ in range(n):
    while(True):
        if primes[count] % 5==1:
            ret.append(primes[count])
            count += 1
            break
        count += 1
print(" ".join(map(str, ret)))

    




Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
#define pll pair<ll,ll>
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }


int main(){
    ll l,r,d,ans=0;
    cin>>l>>r>>d;
    rep(i,l,r+1)if(i%d==0)ans++;
    cout<<ans;
}




Measured memory_bytes: 3644
#include <iostream>
#include <cstring>
#define MOD 1000000007

using namespace std;

int main() {
	// your code goes here

	string s;
	cin>>s;
	
	long long dp[ s.length() ][ 13 ] ;

	memset( dp , 0 , sizeof(dp) );
	
	long long x=1;		
	
	if(s[s.length()-1]=='?'){

		for(int i=0;i<=9;i++)
			dp[s.length()-1][ i ]=1;

	}
	else
		dp[s.length()-1][ s[s.length()-1]-'0' ]=1;
	
	for(int i=s.length()-2 ; i>=0 ; i-- ){

		x = (x * 10 )% 13; 
		
		if(s[i]=='?'){

			for( int j=0 ; j<=9 ; j++){
				
				for(int k=0 ; k<13 ; k++){
					
					dp[ i ] [ ( (j*x)%13 + k )%13 ] = ( dp[ i ] [ ( (j*x)%13 + k )%13 ] +  dp[i+1][k]  )%MOD;
						  
				}
	
			}
				
		}
		else{
				int j = s[i] - '0';
				for(int k=0 ; k<13 ; k++){
					
					dp[ i ] [ ( (j*x)%13 + k )%13 ] = ( dp[ i ] [ ( (j*x)%13 + k )%13 ] +  dp[i+1][k]  )%MOD;
						  
				}
			
		}
		
	}	

	cout << dp[0][5]<<endl;
	return 0;
}

Measured memory_bytes: 10624
#include<bits/stdc++.h>
using namespace std;
const int MAX_N = 1<<20;

struct data{
  int l,r;
};

data dat[2*MAX_N-1];
int n;

void init(int n_){
  n=1;
  while(n<n_)n*=2;
  for(int i=0;i<2*n-1;i++)
    dat[i].l=dat[i].r=0;
}

void query(int a,int b,int k,int l,int r,int x){
  if(r<=a||b<=l)return;
  if(a<=l&&r<=b){
    if(!dat[k].l)dat[k].l=dat[k].r=x;
    else if(dat[k].r+1==x)dat[k].r=x;
    else dat[k].l=dat[k].r=-1;
  }else{
    int k1=k*2+1,k2=k*2+2;
    int L=dat[k].l,R=dat[k].r;
    if(L){
      if(!dat[k1].l)dat[k1].l=L,dat[k1].r=R;
      else if(dat[k1].r+1==L)dat[k1].r=R;
      else dat[k1].l=dat[k1].r=-1;
      if(!dat[k2].l)dat[k2].l=L,dat[k2].r=R;
      else if(dat[k2].r+1==L)dat[k2].r=R;
      else dat[k2].l=dat[k2].r=-1;
      dat[k].l=dat[k].r=0;
    }
    query(a,b,k1,l,(l+r)/2,x);
    query(a,b,k2,(l+r)/2,r,x);
  }
}

int main(){
  int k,t,l,r,x;
  cin>>n>>k>>t;
  init(n);
  for(int i=0;i<t;i++){
    scanf("%d%d%d",&l,&r,&x);
    l--,r--;
    query(l,r+1,0,0,n,x);
  }
  int ans=0;
  for(int i=0;i<n;i++){
    query(i,i+1,0,0,n,k+1);
    if(dat[n+i-1].l==1&&dat[n+i-1].r==k+1)
      ans++;
  }
  cout<<ans<<endl;
  return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(a);
        string st;
        cin >> st;
        
    if (a >= 3200) {
        cout << st << endl;
    } else {
        cout << "red" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int N, K;
int a[5001];
int ans;
bool is;
 
int main() {
  cin >> N >> K;
 
  for(int i = 0; i < N; i++) {
    cin >> a[i];
  }
  sort(a,a+N);
 
  int l = 0;
  int r = N;
  while(r > l){
    int s = (l+r)/2;
    if(a[s] > K){r = s;continue;}
    
    is = false;
    bool dp[N+2][K+2] = {};
    dp[0][0] = true;
    if(s > 0)dp[0][a[0]] = true;
    for(int j = 1; j < N; j++) {
      for(int k = 0; k < K; k++) {
	if(dp[j-1][k]) dp[j][k] = true;
	if(j != s && k >= a[j] && dp[j-1][k-a[j]]) {
	  dp[j][k] = true;
	}
      }
    }
    for(int m = K - a[s]; m < K; m++) {
      if(dp[N-1][m]) {is = true; break;}
    }
    if(is) r = s;
    else l = s+1;
  
  }
  cout << r <<endl;
}

Measured memory_bytes: 24704
import Data.List

main=do
    n<-readLn::IO Int
    print $ length $ filter (<=n) $ map read g

g = u $ sort $ concatMap m $ concatMap k [3..9]

u [x] = [x]
u (a:b:x)
    | a==b = u (b:x)
    | otherwise = a:u (b:x)

k n = [(a,b,c)|a<-[1..n-2],b<-[1..n-a-1],c<-[1..n-a-b]]

m :: (Int,Int,Int)->[String]
m (0,0,0) = [[]]
m (a,0,0) = map ('3':) (m (a-1,0,0))
m (0,b,0) = map ('5':) (m (0,b-1,0))
m (0,0,c) = map ('7':) (m (0,0,c-1))
m (0,b,c) = map ('5':) (m (0,b-1,c)) ++ map ('7':) (m (0,b,c-1))
m (a,0,c) = map ('3':) (m (a-1,0,c)) ++ map ('7':) (m (a,0,c-1))
m (a,b,0) = map ('3':) (m (a-1,b,0)) ++ map ('5':) (m (a,b-1,0))
m (a,b,c) = map ('3':) (m (a-1,b,c)) ++ map ('5':) (m (a,b-1,c)) ++ map ('7':) (m (a,b,c-1))

Measured memory_bytes: 20904
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
#define fi first
#define se second
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

i64 pow_mod(i64 n, i64 k, i64 m){
  i64 r = 1;
  for(;k;k>>=1){
    if(k&1) r=(r*n)%m;
    n=(n*n)%m;
  }
  return r;
}

struct uf{
  private:
    vi par, rank, size;
  public:
    uf(i64 n){ init(n); }
    void init(i64 n){
      par.resize(n);
      rank.resize(n,0);
      size.resize(n,1);
      rep(i,n) par[i] = i;
    }
    i64 root(i64 x){
      if(par[x] == x) return x;
      return par[x] = root(par[x]);
    }
    bool same(i64 x, i64 y){ return root(x) == root(y); }
    void unite(i64 x, i64 y){
      x = root(x), y = root(y);
      if(x==y) return;
      if(rank[x]==rank[y]) rank[x]++;
      if(rank[x]<rank[y]) swap(x,y);
      par[y] = x;
      size[x] += size[y];
    }
    i64 num(i64 x){ return size[root(x)]; }
};

void Main()
{
  i64 h,w;
  cin >> h >> w;
  if(h==1 || w==1){
    cout << "1\n";
    return;
  }else{
    cout << (h*w+1)/2 << endl;
  }
}

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pr pair<ll, ll>
#define tp tuple<ll, ll, ll>
using namespace std;
long long int mod = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll h, w, ans;
    cin >> h >> w;
    if((h * w) % 2 == 0)
        ans = (h*w)/2;
    else
    {
        ans = (h*w)/ 2 + 1;
    }
    if(h == 1 || w == 1)
        ans = 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

//update 2020/1/1 23:01

public class Main{

  static Scanner sc = new Scanner(System.in);
  static StringBuilder sb = new StringBuilder();

  public static void main(String[] args) {

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

    Arrays.sort(a);

    boolean ok = true;

    for(int i=1;i<n;i++){
      if(a[i-1]==a[i]){
        ok = false;
      }
    }

    if(ok){
      System.out.println("YES");
    }
    else{
      System.out.println("NO");
    }


    //System.out.println();

  }
  /*
    static String toSmall(String s){
      char c = s.charAt(0);
      //if(Character.isUpperCase(c)){
      if(c<=90){
        c += 32;
      }
      return String.valueOf(c);
    }
    static String toBig(String s){
      char c = s.charAt(0);
      //if(Character.isLowerCase(c)){
      if(c>=97){
        c -= 32;
      }
      return String.valueOf(c);
    }
  */

  static String toSmall(String s){
    return s.toLowerCase();
  }

  static String toBig(String s){
    return s.toUpperCase();
  }

  static String next(){
    return sc.next();
  }

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

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

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

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char a){
    return a - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


Measured memory_bytes: 52288
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))
balls = defaultdict(int)
default_pattern = defaultdict(int)
pick_pattern = defaultdict(int)

for ai in A:
    balls[ai] += 1

total = 0
for k, v in balls.items():
    remain_balls = v - 1
    if v <= 1:
        default_pattern[k] = 0
    else:
        default_pattern[k] = (v * (v - 1)) // 2
        total += (v * (v - 1)) // 2

    if remain_balls <= 1:
        pick_pattern[k] = 0
    else:
        pick_pattern[k] = (remain_balls * (remain_balls - 1) // 2)

for ai in A:
    ans = total
    print(ans - default_pattern[ai] + pick_pattern[ai])

Measured memory_bytes: 41108
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;


const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    string S; cin >> S;
    string key = "keyence";
    int count = 0;
    int len = min(int(S.size()), 7);
    for(int i=0;i<len;i++){
        if(S[i] == key[i]) count++;
        else break;
    }
    for(int i=0;i<len;i++){
        if(S[S.size()-1-i] == key[6-i]) count++;
    }
    if (count >=7) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  int n, k;
  readf("%s %s\n", &n, &k);

  if (1 + 2 * (k - 1) <= n) {
    writeln("YES");
  } else {
    writeln("NO");
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <ctime>
#include <string>
#include <cstring>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

const int INF = (int)1e6;
const int N = 103;
const int V = 300;
const int E = (int)5e4;

struct Edge
{
    int to, cap;

    Edge() : to(), cap() {}
    Edge (int _to, int _cap) : to(_to), cap(_cap) {}
};
Edge ed[E];
int edSz;
vector<int> g[V];
int S, T;
int n, m;;
char str[N];

int dist[V];
int q[V];
int idx[V];
int topQ;

void addEdge(int v, int to, int cap)
{
    ed[edSz] = Edge(to, cap);
    g[v].push_back(edSz++);
    ed[edSz] = Edge(v, 0);
    g[to].push_back(edSz++);
}

void read()
{
    scanf("%d%d", &n, &m);
    S = n + m;
    T = S + 1;
    for (int i = 0; i < n; i++)
    {
        scanf("%s", str);
        for (int j = 0; j < m; j++)
        {
            if (str[j] == '.') continue;
            addEdge(i, n + j, 1);
            addEdge(n + j, i, 1);
            if (str[j] == 'S')
            {
                addEdge(S, i, INF);
                addEdge(S, n + j, INF);
            }
            if (str[j] == 'T')
            {
                addEdge(i, T, INF);
                addEdge(n + j, T, INF);
            }
        }
    }
    n = T + 1;
    return;
}

bool BFS()
{
    for (int i = 0; i < n; i++)
        dist[i] = INF;
    dist[S] = 0;
    topQ = 1;
    q[0] = S;
    for (int k = 0; k < topQ; k++)
    {
        int v = q[k];
        for (int id : g[v])
        {
            Edge e = ed[id];
            if (e.cap <= 0) continue;
            int to = e.to;
            if (dist[to] <= dist[v] + 1) continue;
            dist[to] = dist[v] + 1;
            q[topQ++] = to;
        }
    }
    return dist[T] < INF;
}

int dfs(int v, int flow)
{
    if (v == T || flow == 0) return flow;
    int res = 0;
    for (int &i = idx[v]; i < (int)g[v].size(); i++)
    {
        int id = g[v][i];
        Edge e = ed[id];
        int to = e.to;
        if (dist[to] != dist[v] + 1) continue;
        int df = dfs(to, min(flow, e.cap));
        flow -= df;
        res += df;
        ed[id].cap -= df;
        ed[id ^ 1].cap += df;
        if (flow == 0) return res;
    }
    return res;
}

int Flow()
{
    int res = 0;
    while(BFS())
    {
        for (int i = 0; i < n; i++)
            idx[i] = 0;
        res += dfs(S, INF);
    }
    return res;
}

int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    read();
    int res = Flow();
    if (res >= INF / 2)
        printf("-1\n");
    else
        printf("%d\n", res);

    return 0;
}

Measured memory_bytes: 896
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>

int const yoko = 1;
int const tate = 2;

void tetris(std::vector<std::vector<int>>& z) {
  size_t m = z[0].size();
  std::vector<std::vector<int>> y(5, std::vector<int>(m));

  size_t i = 0;
  for (size_t j = 0; j < m; ++j) {
    int cur = 0;
    for (size_t k = 0; k < 5; ++k) cur += z[k][j];
    if (cur == 5) continue;
    for (size_t k = 0; k < 5; ++k) y[k][i] = z[k][j];
    ++i;
  }
  z = std::move(y);
}

int testcase_ends() {
  size_t n;
  scanf("%zu", &n);
  if (n == 0) return 1;

  size_t m = 5*n+10;
  std::vector<std::vector<int>> z(5, std::vector<int>(m));
  for (size_t i = 0; i < n; ++i) {
    size_t d, p, q;
    scanf("%zu %zu %zu", &d, &p, &q);
    --q;

    size_t l = q;
    size_t r = q;
    if (d == yoko) r += p-1;

    size_t h = 0;
    for (size_t j = l; j <= r; ++j) {
      for (size_t k = m; k--;) {
        if (z[j][k]) {
          h = std::max(h, k+1);
          break;
        }
      }
    }

    if (d == yoko) {
      for (size_t i = l; i <= r; ++i) ++z[i][h];
    } else if (d == tate) {
      for (size_t i = 0; i < p; ++i) ++z[q][h+i];
    }

    tetris(z);
  }
  int res = 0;
  for (auto const& zi: z)
    res += std::accumulate(zi.begin(), zi.end(), 0);

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

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 2780
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut t = vec![0i64; n];
    for i in 0..n {
        t[i] = read();
    }

    let mut ans = t[0];
    for i in 1..n {
        let temp = gcd(ans, t[i]);
        ans = ans / temp * t[i];
    }
    println!("{}", ans);
}
fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        return a;
    }
    gcd(b, a % b)
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
import math

def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    A.sort()

    total = 0
    for i in range(1, N):
        total += A[N - 1 - math.floor(i/2)]
    print(total)

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 32936
a, b = map(int, input().split())

if a > 0 and b > 0:
    print('Positive')
elif a < 0 and b < 0:
    if ((a - b) + 1) % 2 == 0:
        print('Positive')
    else:
        print('Negative')
else:
    print('Zero')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define SZ(a) (int)(a.size())
#define PB push_back
#define LL long long
#define X first
#define Y second

const int MAX = 100005;
const int MAGIC = 350;
vector<vector<pair<int , pair<int , int> > > > g(MAX);
int timer;
int cnt[MAX];
int tin[MAX];
int tout[MAX];
int D[MAX];
int dp[MAX][18];
pair<int , int> d[400][MAX];
int idx[MAX];
vector<vector<pair<pair<int , int> , int> > > edges(MAX);
bool isIn(int u , int v)
{
	return tin[u] >= tin[v] && tout[u] <= tout[v];
}
int lca(int u , int v)
{
	if(isIn(u , v))
		return v;
	if(isIn(v , u))
		return u;
	for(int i = 17; i >= 0; i--)
	{
		if(!isIn(v , dp[u][i]))
		{
			u = dp[u][i];
		}
	}
	return dp[u][0];
}
void dfs(int u, int p = -1)
{
	tin[u] = timer++;
	for(auto v : g[u])
	{
		if(v.X == p)
			continue;
		D[v.X] = D[u] + v.Y.X;
		dp[v.X][0] = u;
		for(int i = 1; i <= 17; i++)
			dp[v.X][i] = dp[dp[v.X][i - 1]][i - 1];
		dfs(v.X , u);
	}
	tout[u] = timer++;
}
void dfs2(int u , int i, int idx, int par = -1)
{
	for(auto v : g[u])
	{
		if(v.X == par)
			continue;
		d[idx][v.X] = {d[idx][u].X + (v.Y.Y == i) , d[idx][u].Y + (v.Y.Y == i) * v.Y.X};
		dfs2(v.X , i , idx , u);
	}
}
int main()
{
	int n , q;
	cin >> n >> q;
	for(int i = 1; i < n; i++)
	{
		int u , v , c , d;
		cin >> u >> v >> c >> d;
		u--;v--;
		g[u].PB({v , {d , c}});
		g[v].PB({u , {d , c}});
		edges[c].PB({{u , v} , d});
	}
	dfs(0);
	memset(idx , -1 , sizeof idx);
	int ptr = 0;
	for(int i = 1; i < n; i++)
		if(SZ(edges[i]) >= MAGIC)
		{
			idx[i] = ptr++;
			dfs2(0 , i , idx[i]);
		}
	while(q--)
	{
		int x , y , u , v;
		cin >> x >> y >> u >> v;
		u--;v--;
		int LCA = lca(u , v);
		if(idx[x] == -1)//small
		{
			int ans = D[u] + D[v] - 2 * D[LCA];
			for(auto e : edges[x])
			{
				if(isIn(e.X.X , LCA) && isIn(e.X.Y , LCA) && (isIn(u , e.X.X) && isIn(u , e.X.Y) || isIn(v , e.X.X) && isIn(v , e.X.Y)))
				{
					ans -= e.Y;
					ans += y;
				}
			}
			cout << ans << endl;
		}
		else
		{
			int ans = D[u] + D[v] - 2 * D[LCA];
			//cerr << ans << endl;
			ans -= d[idx[x]][u].Y + d[idx[x]][v].Y - 2 * d[idx[x]][LCA].Y;
			//cerr << ans << endl;
			ans += y * (d[idx[x]][u].X + d[idx[x]][v].X - 2 * d[idx[x]][LCA].X);
			cout << ans << endl;
		}
	}
    return 0;
}


Measured memory_bytes: 27940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll A, B, C;
ll t;
ll ret = 0;

void input() {
  IN(N);
}

void solve() {
  PRINT(N*N);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
package main

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

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func solve(hs []int, N int, K int) int {
	dp := make([]int, N+1)
	for i:=2; i<=N; i++ {
		dp[i] = math.MaxInt32
		for l:=1; l<=K; l++ {
			if i-l <= 0 {
				// 无效石头
				continue
			}
			dp[i] = min(dp[i], dp[i-l]+abs(hs[i-1]-hs[i-l-1]))
		}
	}
	return dp[N]
}

func readLineNum(bf *bufio.Reader) int {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	N, _ := strconv.Atoi(line)
	return N
}

func readLineNums(bf *bufio.Reader) []int {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	fields := strings.Split(line, " ")
	nums := []int{}
	for _, field := range fields {
		num, _ := strconv.Atoi(field)
		nums = append(nums, num)
	}
	return nums
}

func main() {
	bf := bufio.NewReader(os.Stdin)
	nk := readLineNums(bf)
	hs := readLineNums(bf)
	fmt.Println(solve(hs, nk[0], nk[1]))
}


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

int main() {
   ll n,c=0;
  cin>>n;
  string s;
  cin>>s;
  
  for(int i=1;i<n;i++)
  {
      if(s[i]==s[i-1])
      {
        s[i-1]='0';
      }
  }
  //cout<<s<<endl;
  for(int i=0;i<n;i++)
  {
    if(s[i]!='0')
    {
      c++;
    }
  }
  cout<<c<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const ll mod=1000000007;
int main(void){
    double A,B,H,M;
    cin>>A>>B>>H>>M;
    double a=H/12+M/(60*12),b=M/60;
    double c=(a-b)*2*M_PI;
    double C2=A*A+B*B-2*A*B*cos(c);
    printf("%.20lf\n",pow(C2,0.5));
}

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 1000000007LL
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(i=a;i<=b;i++)

#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

ll mypow(ll a, ll b) { if(b == 0) return 1; ll temp=mypow(a,b/2); temp=(temp*temp)%INF; if(b%2 == 1) temp=(a*temp)%INF; return temp; }
int mygcd(int a, int b) { if(b==0) return a; return mygcd(b,a%b); }
int cntBits(ll a) { int ret=0; while(a>0) { ret++; a/=2; } return ret; }

int visit[100010], A[100010];

vi g[100010];

void dfs(int n)
{
	if(visit[n]==1) return;
	visit[n]=1;
	A[n]=1;
	for(auto x: g[n])
	{
		dfs(x);
		A[n]=max(A[n],1+A[x]);
	}
	return;
}

int main()
{
	ios::sync_with_stdio(0);
	int tt=1,tcase; 
	//cin >> tt;
	rep(tcase,1,tt)
	{
		int n,m; cin >> n >> m;
		for(int i=0;i<m;i++)
		{
			int u,v; cin >> u >> v;
			g[u].pb(v);
		}
		int ans=0;
		for(int i=1;i<=n;i++)
		{
			if(visit[i]==0)
			{
				dfs(i);
				ans=max(ans,A[i]);
			}
		}
		cout << ans-1 << "\n";
	}
	return 0;
}


Measured memory_bytes: 8576
#include<iostream>
using namespace std;
typedef long long ll;
int main()
{
  int n,i;
  ll d[87];
  cin >> n;
  d[0]=2;
  d[1]=1;
  for(i=2;i<=n;i++)
    d[i]=d[i-2]+d[i-1];
  cout << d[n] << endl;
  return 0;
}

Measured memory_bytes: 3584
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

constexpr int inf = 2147483647;
//constexpr int64_t inf64 = 9223372036854775807;
//constexpr int mod = 1e9+7;

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

  int n, k;
  cin >> n >> k;

  n--; k--;
  cout << (n+k-1)/(k) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <utility>
#include <algorithm>
#include <numeric>
#define load ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ll long long
#define ull unsigned long long
#define fori(i,n) for (int i=0; i<int(n);i++)
#define srt(v) sort(v.begin(), v.end())
const int INF = 1e9;
const double PI = 3.14159265358979323846;

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

ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}

void solve(){

}

int main(){
	load;
	int x;
	string s;
	cin >>x>>s;
	if (x>=s.length()) cout << s;
	else{
		for(int i=0; i<x;i++) cout << s[i];
		cout << "...";
	}


}



Measured memory_bytes: 3600
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>

    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<int,int>;

    int main(){
      int a,b,x;cin>>a>>b>>x;
      double pi = 3.1415926535;
      double s = (double)x/(double)a;
      double a2 = pow(a,2);
      double b2 = pow(b,2);
      double res;
      if(s>=a*b/2)res = atan(2*(a*b-s)/a2)*180/pi;
      else res = 90-(atan(2*s/b2)*180/pi);
      cout<<fixed<<setprecision(10)<<res<<endl;
    }
    


Measured memory_bytes: 512
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

input1 = input()
input2 = input()

N = int(input1.split()[0])
K = int(input1.split()[1])

nums = [int(s) for s in input2.split()]

divs = make_divisors(sum(nums))

possible = []

for i in divs:
    nord = [s%i for s in nums]
    nord.sort()
    mt_size = sum(nord) // i
    moves = sum(nord[0:N-mt_size])
    if moves <= K:
        possible.append(i)

print(int(max(possible)))

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

int main() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    
    //ユークリッド互除法
    long long p = min(c, d);
    long long q = max(c, d);
    long long r = q % p;
    
    while(r != 0) {
        q = p;
        p = r;
        r = q % p;
    }
    long long lcm_cd = c * d / p; //cとdの最小公倍数
    
    long long num_m_c = b / c - (a - 1) / c;    //cの倍数の数
    long long num_m_d = b / d - (a - 1) / d;    //dの倍数の数
    long long num_m_cd = b / lcm_cd - (a - 1) / lcm_cd;   //c,dの最小公倍数の数
    
    long long ans = b - (a - 1) - (num_m_c + num_m_d - num_m_cd);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c[100],i,d=0,x=0;
	scanf("%d%d",&a,&b);
	for(i=0;i<b;i++) scanf("%d",&c[i]);
	while(1){
		for(i=0;i<b;i++){
			if(a-d==c[i]){
				x=1;
				break;
			}
		}
		if(x==0){
			printf("%d\n",a-d);
			return 0;
		}
		x=0;
		for(i=0;i<b;i++){
			if(a+d==c[i]){
				x=1;
				break;
			}
		}
		if(x==0){
			printf("%d\n",a+d);
			return 0;
		}
		x=0;
		d++;
	}
	return 0;
}


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

int main(){
  
    int N,Q;
    cin>>N>>Q;
    queue<pair<string,int>> S;
    for(int i=0;i<N;i++){
        int T;
        string name;
        cin>>name>>T;
        S.push(make_pair(name,T));
    }
    int time=0;
    while(!S.empty()){
        if(S.front().second<=Q){
            time+=S.front().second;
            cout<<S.front().first<<" "<<time<<endl;
            S.pop();
        }
        else{
            S.front().second-=Q;
            time+=Q;
            S.push(S.front());
            S.pop();
        }
    }
}



Measured memory_bytes: 6312
#include "bits/stdc++.h"
using namespace std;

#define rep(i, a, b) for(int i=a; i<=b; i++)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int) x.size()
#define pb push_back
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int n, k, x;
vi a={0};

int main(){
  // freopen("input.txt", "r", stdin); 
  // freopen("output.txt", "w", stdout);
  cin.sync_with_stdio(0); cin.tie();
  cin.exceptions(cin.failbit);

  cin >> n >> k;
  rep(i, 1, n){
  	cin >> x;
  	a.pb(x);
  }
  vector<vi> ps(n+1, vi(k+1));
  vector<vi> dp(n+1, vi(k+1));

  rep(i, 0, n){
  	dp[i][0]=1;
  }
  rep(i, 1, k){
  	dp[0][i]=0;
  }

  rep(i, 0, n){
  	rep(j, 0, k){
  		ps[i][j]=1;
  	}
  }
  rep(i, 1, n){
  	rep(j, 1, k){
  		dp[i][j]=(MOD+ps[i-1][j]-(a[i]<j? ps[i-1][j-a[i]-1]:0))%MOD;
  		ps[i][j]=(ps[i][j-1]+dp[i][j])%MOD;
  	}
  }
  cout << dp[n][k];
}

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

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

class EOrPlusMax {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n;
        in>>n;
        vector<int> a(1<<n),b(1<<n);
        for(auto&i:a) in>>i;
        pair<int,int> m(0,0);
        Fr(i,(1<<n)-1){
            m=make_pair(0,0);
            for(int j=i;;j=(j-1)&i){
                if(a[j]>m.first) m.second=m.first,m.first=a[j];
                else if(a[j]>m.second) m.second=a[j];
                if(j==0) break;
            }
            b[i]=max(b[i-1],m.first+m.second);
            out<<b[i]<<endl;
        }

    }
};

int main() {
    EOrPlusMax solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 5120