akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define taskname "A"
#define pb push_back
#define mp make_pair
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
const int maxn = 1e5 + 5;
const int maxs = (1 << 16);
const int mod = 1e9 + 7;
const int logn = log2(maxn) + 1;

struct trie{
    int go[26];
    int cor = 0;
    int cnt = 0;
}node[maxn * 4];

int id[maxn];
int n , q;
int nTime = 1;
int F[26][26];
int f[maxn][26][26];
int cnt[maxn];
void Travel(int u , int Count){
    if(node[u].cor){
        cnt[node[u].cor] = Count;
        for(int i = 0 ; i < 26 ; ++i){
            for(int j = 0 ; j < 26 ; ++j){
                f[node[u].cor][i][j] = F[i][j];
            }
        }
    }
    for(int i = 0 ; i < 26 ; ++i){
        if(node[u].go[i] == 0)continue;
        for(int j = 0 ; j < 26 ; ++j){
            if(i == j)continue;
            F[i][j] += node[node[u].go[j]].cnt;
        }
        Travel(node[u].go[i], Count+(node[u].cor != 0));
        for(int j = 0 ; j < 26 ; ++j){
            if(i == j)continue;
            F[i][j] -= node[node[u].go[j]].cnt;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    if(fopen(taskname".inp", "r")) {
        freopen(taskname".inp", "r", stdin);
        freopen(taskname".out", "w", stdout);
    }
    cin >> n;
    for(int i = 1 ; i <= n ; ++i){
        string s;cin >> s;
        int it = 1;
        for(char c : s){
            c -= 'a';
            if(node[it].go[c] == 0)node[it].go[c] = ++nTime;
            it = node[it].go[c];
            node[it].cnt++;
        }
        node[it].cor = i;
        id[i] = it;
    }
    Travel(1 , 0);
    cin >> q;
    while(q--){
        int u;cin >> u;
        string s;cin >> s;
        int res = 1;
        for(int i = 0 ; i < 26 ; ++i){
            for(int j = i + 1 ; j < 26 ; ++j){
                res += f[u][s[j] - 'a'][s[i] - 'a'];
            }
        }
        cout <<  res + cnt[u] << '\n';
    }
}



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

int main()
{
  int n, r = 0, m = 0;
  vector<int> a;
  array<int, 1000000> u = {0};
  array<bool, 1000000> f = {false}, c = {false};
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    int t;
    cin >> t;
    a.push_back(t);
    u[t - 1]++;
    if (t > m)
      m = t;
  }
  sort(a.begin(), a.end());

  for (int i = 0; i < n; i++)
    if (f[a[i] - 1] == false && c[a[i] - 1] == false)
    {
      c[a[i] - 1] = true;
      if (u[a[i] - 1] == 1)
        r++;
      for (int j = a[i] * 2; j <= m; j += a[i])
        f[j - 1] = true;
    }

  cout << r << endl;
}


Measured memory_bytes: 10128
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////




int main() {

	ll N, A;
	cin >> N >> A;
	if (N % 500 <= A) { cout << "Yes"; }
	else { cout << "No"; }


	system("PAUSE");

	

}


Measured memory_bytes: 504
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<iterator>
#include<set>
#include<queue>

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

using namespace std;


void output(int i,int j){
	char c1 = 'A' + j;
	cout << c1 << i+1 << endl;
}

int main(){
	int H,W; cin >> H >> W;
	rep(i,H){
		rep(j,W){
			string temp; cin >> temp;
			if(temp == "snuke"){
				output(i,j);
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#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++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int a,b,ab,xa,xb;
    cin>>a>>b>>ab>>xa>>xb;
    int ans=1e9+7;
    int cnt=0;
    //abでmin(xa,xb)を買い、残りをa,bで
    if(xa>xb){
        cnt +=xb*ab*2;
        cnt +=(xa-xb)*a;
        ans =min(ans,cnt);
        cnt=0;
    }
    else{
        cnt=xa*ab*2+(xb-xa)*b;
        ans =min(ans,cnt);
        cnt=0;
    }
    //abで全部買う
    cnt=max(xa,xb)*ab*2;
    ans=min(ans,cnt);
    cnt=0;
    //a,bだけで買う
    cnt=xa*a+xb*b;
    ans =min(ans,cnt);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
char PS (char a) {
  if (a !='Z') {
    return a+0X01;
  }
  else {
    return 'A';
  }
}
using namespace std;
 
int main() {
  int N;
  string S;
  cin >> N >> S;
  
  for (int j=0; j<S.size(); j++) {
    for (int i=0; i<N;i++) {
      S.at(j)=PS(S.at(j));
    }
  }
  cout << S << endl;
  
    

  
  
  
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  int n,a,b;
  cin >> n >> a >> b;
  int i,temp;
  int sum = 0;
  int ans = 0;
  for(i = 1;i <= n;++i){
    temp = i;
    while(temp){
      sum += temp % 10;
      temp /= 10;
    }
    if(sum >= a && sum <= b){
      ans += i;
    }
    sum = 0;
  }
  cout << ans << endl;
  return 0;
}

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

int main(void){
	int K,S;
	cin >> K >> S;

	int ans = 0;

	for(int x = 0; x <= K; ++x){
		for(int y = 0; y <= K; ++y){
			int z = S - x - y;
			if(0 <= z and z <= K){
				ans = ans + 1;
			}
		}
	}

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

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

#define rep(i,n) for(int (i)=0; (i)<(int)(n); (i)++)
#define all(x) (x).begin(), (x).end()
#define sqr(x) (x)*(x)
#define CEIL(a,b) ((a)+(b)-1) /(b)

typedef long long ll;
const int INF = 1001001001;

void sort_second(vector<pair<ll, ll>> &A, int N); // A:array of pair, N:size of array
ll pow_n(ll a, int n); // a^n
ll nCr(int n, int r); // nCr;

int main() {
    string N;
    cin >> N;
    int K, L;
    cin >> K;
    L = N.length();
    
    // 初期化
    int dp[L+1][2][K+2];
    rep(i, L+1) {
        rep(j, 2) {
            rep(k, K+2) dp[i][j][k] = 0;
        }
    }
    dp[0][0][0] = 1;
    
    rep(i, L) {
        int D = N[i] - '0'; // (i+1)桁目の数字
        rep(j, 2) {
            rep(k, K+1) {
                rep(l, (j ? 10 : D + 1)) {
                    dp[i+1][j || (l < D)][k + ((l!=0) ? 1:0)] += dp[i][j][k];
                }
            }
        }
    }

    cout << dp[L][0][K] + dp[L][1][K] << endl;

    return 0;
}

void sort_second(vector<pair<ll, ll>> &A, int N) {
    rep(i, N) swap(A.at(i).first, A.at(i).second);
    sort(all(A));
    rep(i, N) swap(A.at(i).first, A.at(i).second);
}
ll pow_n(ll a, int n) {
    rep(i, n) a*=a;
    return a;
}
ll nCr(int n, int r) {
    ll ret = 1;
    rep(i, r) ret *= n-i;
    rep(i, r) ret /= (i+1);
    return ret;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long
using namespace std;
using pi=pair<int,int>;
main(){
	int n,m,r=0;
	cin>>n>>m;
	vector<pi> job(n);
	for(auto& p:job)cin>>p.first>>p.second;
	sort(job.begin(),job.end());
	priority_queue<int> que;
	for(int day=1,pos=0;day<=m;++day){
		while(pos<n&&job[pos].first<=day)que.push(job[pos++].second);
		if(!que.empty()){r+=que.top();que.pop();}
	}
	cout<<r<<endl;
}


Measured memory_bytes: 2936
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  if(a == b)
    cout << c << endl;
  else if(a == c)
    cout << b << endl;
  else
    cout << a << endl;
  return 0;
}


Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split()))

maxa=max(a)
dp=[0]*(maxa+1)
for num in a:
    for i in range(2,10**10):
        if num*i > maxa:
            break
        dp[num*i]=1

import collections
c = collections.Counter(a)

ans=0
for num,cnt in c.items():
    if cnt==1 and dp[num]==0:
        ans+=1
print(ans)

Measured memory_bytes: 119468
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define double long double
using namespace std;
ll n, ans = 0, memo = 0; ll a[114514], cnt[114514];
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n)cnt[a[i] - 1]++;
	rep(i, 114514) {
		if (cnt[i])memo++;
		if (cnt[i] > 1)ans += cnt[i] - 1;
	}
	cout << memo - ans % 2 << endl;
	getchar(); getchar(); return 0;
}


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

using namespace std ;



int arr[100006][3];
int dp[100006][3];

int fun(int n,int i){
    
    if(n==0) return 0;
    
    if(dp[n][i]!=-1)return dp[n][i];
    
    if(i==0){
        return dp[n][i] = arr[n][i]+max(fun(n-1,1),fun(n-1,2));
    }else if(i==1){
        return dp[n][i] = arr[n][i]+max(fun(n-1,0),fun(n-1,2));
    }else return dp[n][i] = arr[n][i]+max(fun(n-1,1),fun(n-1,0));
    
}

int main(){
    
    int n ;
    cin>>n;
    for(int i=1 ;i<=n;i++)cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
    
    memset(dp, -1 ,sizeof(dp));
    cout<<max(fun(n,0),max(fun(n,1),fun(n,2)))<<endl;
    return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N,M,X;cin >> N >> M >> X;
  int count1 = 0;
  int count2 = 0;
  rep(i,M){
    int x; cin >> x;
    if(x<X)count1++;
    else count2++;
  }
  cout << min(count1,count2) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c,sum1,sum2,sum3,min;
    scanf("%d %d %d",&a,&b,&c);
    if(a>=1 && a<=10000 && b>=1 && b<=10000 && c>=1 && c<=10000)
    {
        sum1 = a + b;
        sum2 = a + c;
        sum3 = b + c;
        if(sum1<sum2 && sum1<sum3)
            min = sum1;
        else if(sum2<sum1 && sum2<sum3)
            min = sum2;
        else
            min = sum3;
        printf("%d\n",min);
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<functional>
#include<algorithm>
#include<string>
#include<queue>
#include<math.h>

using namespace std;

int main(void){

    int x;
    cin >> x;

    x = (x % 2 == 0 && x != 2 ? x + 1 : x);

    int check = 0;
    for(int i = x;;i += 2){
        for(int j = 3; j <= sqrt(i);j += 2){
            if(i%j == 0){
                check = 1;
                break;
            }
        }
        if(check == 0){
            cout << i << endl;
            return 0;
        }else{
            check = 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		sc.close();
		List<String> list = new ArrayList<String>();
		String[] num = {"3", "5", "7"};
		for(int a = 0; a < 3; a++) {
			//list.add(num[a]);
			for(int b = 0; b < 3; b++) {
				//list.add(num[a] + num[b]);
				for(int c = 0; c < 3; c++) {
					list.add(num[a] + num[b] + num[c]);
					for(int d = 0; d < 3; d++) {
						list.add(num[a] + num[b] + num[c] + num[d]);
						for(int e = 0; e < 3; e++) {
							list.add(num[a] + num[b] + num[c] + num[d] + num[e]);
							for(int f = 0; f < 3; f++) {
								list.add(num[a] + num[b] + num[c] + num[d] + num[e] + num[f]);
								for(int g = 0; g < 3; g++) {
									list.add(num[a] + num[b] + num[c] + num[d] + num[e] + num[f] + num[g]);
									for(int h = 0; h < 3; h++) {
										list.add(num[a] + num[b] + num[c] + num[d] + num[e] + num[f] + num[g] + num[h]);
										for(int i = 0; i < 3; i++) {
											list.add(num[a] + num[b] + num[c] + num[d] + num[e] + num[f] + num[g] + num[h] + num[i]);
											for(int j = 0; j < 3; j++) {
												list.add(num[a] + num[b] + num[c] + num[d] + num[e] + num[f] + num[g] + num[h] + num[i] + num[j]);
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		List<Long> li = new ArrayList<Long>();
		//System.out.println(list.size());
		for(String t : list) {
			if(isCheck(t)){
				li.add(Long.parseLong(t));
			}
		}
		//System.out.println(li.size());
		int cnt = 0;
		for(Long i : li) {
			if(i <= N) {
				//System.out.println(i);
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	static boolean isCheck(String t) {
		boolean flag1 = false;
		boolean flag2 = false;
		boolean flag3 = false;
		for(int i = 0; i < t.length(); i++) {
			char c = t.charAt(i);
			if(c == '3') {
				flag1 = true;
			}
			if(c == '5') {
				flag2 = true;
			}
			if(c == '7') {
				flag3 = true;
			}
			if(flag1 && flag2 && flag3) {
				return true;
			}
		}
		return false;
	}
}

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

#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* na , Arg1&& arg1 , Args&&... args ) {
        const char* c = strchr( na + 1 , ',' );
        cerr.write( na , c - na ) << " : " << arg1 << " , ";
        __f( c + 1 , args... );
}
#define endl "\n"
#define all(V) V.begin(),V.end()
#define Unique(V) sort(all(V)),V.erase(unique(all(V)),V.end())
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int LL;
typedef pair <int,int> pii;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const long long INF = 1e18;
const int N = 1e5 + 5;

int n;
int a[ N ];
int dp[ N ];

int main( ) {
        IO;
        #ifdef LOCAL
            //freopen( "input.txt" , "r" , stdin );
        #endif // LOCAL
        string a , b;
        cin >> a >> b;
        int ans = 0;
        for( int i = 0; i < a.size(); i++ ) ans += ( a[i] == b[i] );
        cout << ans << endl;
        return 0;
}










Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    int x=0,y=0,z=1;
    x=a+b;
    y=a-b;
    z=a*b;
    cout << max(x,max(y,z));


}


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

fn main() {
    let cin = stdin();
    let mut sc = Scanner::new(cin.lock());
    let x: i32 = sc.next();
    println!("{}", x * x * x);
}

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn next<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }
}



Measured memory_bytes: 5028
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
class BIT(object):
    def __init__(self,A,dot,e,inv=None):
        n=len(A)
        self.__n=n
        self.__dot=dot
        self.__e=e
        self.__inv=inv
        self.__node=['$']+A # 1-indexed
        for i in range(1,n+1):
            j=i+(i&-i)
            if(j<=n): self.__node[j]=dot(self.__node[i],self.__node[j])

    def add(self,i,w=1):
        i+=1
        while(i<=self.__n):
            self.__node[i]=self.__dot(self.__node[i],w)
            i+=i&-i

    def sum(self,i):
        i+=1
        res=self.__e
        while(i>0):
            res=self.__dot(res,self.__node[i])
            i-=i&-i
        return res

    def range_sum(self,l,r):
        assert(self.__inv)
        return self.__inv(self.sum(r),self.sum(l))

    def bisect_left(self,w,increase=True):
        if(w>self.sum(self.__n-1)): return self.__n
        n=2**((self.__n-1).bit_length())
        res=0
        while(n>0):
            if(res+n<=self.__n and ((w>self.__node[res+n])^(not increase))):
                w-=self.__node[res+n]
                res+=n
            n//=2
        return res

def resolve():
    n=int(input())
    A=list(map(int,input().split()))
    idx=[0]*n
    for i,a in enumerate(A): idx[a-1]=i
    from operator import add
    bit=BIT([0]*n,add,0)

    # calculate
    ans=0
    for k in range(n,0,-1):
        i=idx[k-1]
        bit.add(i)
        s=bit.sum(i)
        l0=bit.bisect_left(s-1)-(s<=1)
        l1=bit.bisect_left(s-2)-(s<=2)
        r0=bit.bisect_left(s+1)
        r1=bit.bisect_left(s+2)
        ans+=k*((l0-l1)*(r0-i)+(r1-r0)*(i-l0))
    print(ans)
resolve()

Measured memory_bytes: 66284
import itertools
import math
import fractions
import functools
s = input()
for i in range(len(s)):
    if i % 2 == 0:
        if not(s[i] == "R" or s[i] == "U" or s[i]=="D"):
            print("No")
            quit()
    else:
        if not(s[i] == "L" or s[i] == "U" or s[i]=="D"):
            print("No")
            quit()
print("Yes")

Measured memory_bytes: 63980
import java.util.Scanner;

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

        String s = sc.next();
        String[] str = new String[3];
        str = s.split(",");
        for (int i = 0; i < 3; i++) {
            System.out.print(str[i]);
            System.out.print(" ");
        }
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, n = 0;
  cin >> A >> B;
  
    for (; A <= B; A++) {
      if (A / 10000 == A % 10 && A % 10000 / 1000 == A / 10 % 10)  n++;
    }
  
  cout << n;
}

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 a: i64 = read();
    let b: i64 = read();
    let c: i64 = read();

    let d = c - a - b;
    if d > 0 && d * d > 4 * a * b {
        println!("Yes");
    }else{
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

inline void YES() { cout << "YES" << endl; } inline void Yes() { cout << "Yes" << endl; }
inline void NO() { cout << "NO" << endl; } inline void No() { cout << "No" << endl; }

int main()
{
	int N; cin >> N;

	REP1C(i, 9)
		REP1C(j, 9)
	{
		if (i * j == N)
		{
			Yes();
			return 0;
		}
	}

	No();
}


Measured memory_bytes: 256
import math
n = int(input())

def fac(m, p):
    step = 1 if p ==2 else 2
    for i in range(p, int(math.sqrt(m)+1), step):
        if m % i == 0:
            return i
    return m

result = str(n) + ':'
r = n
p = 2
while r > 1:
    p = fac(r,p)
    r = r//p
    result = result + " " + str(p)

print(result)

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

if n == 2:
    print(1)
    exit()

ans = set()
for i in range(2, int((n-1) ** 0.5) + 1):
    if (n-1) % i == 0:
        ans.add(i)
        ans.add((n-1) // i)

for i in range(2, int(n ** 0.5) + 1):
    if n % i == 0:
        k = i
        temp = n
        while temp % k == 0:
            temp //= k
        if temp % k == 1:
            ans.add(k)
        k = n // i
        temp = n
        while temp % k == 0:
            temp //= k
        if temp % k == 1:
            ans.add(k)

print(len(ans) + 2)

Measured memory_bytes: 3064
//Azunyan Pero Pero !!!
#include<iostream>
using namespace std;

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

  bool curA = true;

  int len = 0;
  for(int i=0;i<(int)s.size();i++){
    if( (curA && s[i] == 'A') || (!curA && s[i] == 'Z') ){
      curA = !curA;
      len++;
    }
  }
  len /= 2;

  if(len == 0)cout << -1 << endl;
  else{
    for(int i=0;i<len;i++)cout << "AZ";
    cout << endl;
  }
}

Measured memory_bytes: 1184
#include <iostream>
#include <stack>

using namespace std;
static int a = 0;

int main()
{
	int b;
	int c;
	int count = 0;
	int size = 0;
	stack<int> numlist;
	int a[5] = { 0,0,0,0,0 };
	cin >> b;
	cin >> c;
	for (int i = 1; i < 10; i++) {
		a[0] = i;
		a[4] = i;
		for (int j = 0; j < 10; j++) {
			a[1] = j;
			a[3] = j;
			for (int z = 0; z < 10; z++) {
				a[2] = z;
				numlist.push(a[0] * 10000 + a[1] * 1000 + a[2] * 100 + a[3] * 10 + a[4]);
			}
		}
	}
	size=numlist.size();
	for (int i = 0; i < size; i++)
	{
		if (b <= numlist.top() && c >= numlist.top()) {
			count++;
		}
		numlist.pop();
	}
	cout << count;


}

Measured memory_bytes: 3096
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B
// Points/Vectors - Reflection
// status:

#define SUBMIT

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <sstream>
#include <cmath>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

const double eps = 1e-10;

bool almost_equals(double a, double b) { return std::abs(a - b) < eps; }

class point2d {
public:
    point2d() : point2d(0.0, 0.0) {}

    point2d(double x, double y) : x_(x), y_(y) {}

    point2d operator+(const point2d& rhs) const { return {x_ + rhs.x_, y_ + rhs.y_}; }

    point2d operator-(const point2d& rhs) const { return {x_ - rhs.x_, y_ - rhs.y_}; }

    point2d operator*(double rhs) const { return {x_ * rhs, y_ * rhs}; }

    point2d operator/(double rhs) const { return {x_ / rhs, y_ / rhs}; }

    bool operator==(const point2d& rhs) const { return almost_equals(x_, rhs.x_) && almost_equals(y_, rhs.y_); }

    double l2_norm() const { std::sqrt(squared_l2_norm()); }

    double squared_l2_norm() const { return x_ * x_ + y_ * y_; }

    double x() const noexcept { return x_; }

    double y() const noexcept { return y_; }

    friend double dot(const point2d& lhs, const point2d& rhs);

    friend double cross(const point2d& lhs, const point2d& rhs);

private:
    double x_;
    double y_;

private:
};

double dot(const point2d& lhs, const point2d& rhs) {
    return lhs.x_ * rhs.x_ + lhs.y_ * rhs.y_;
}

double cross(const point2d& lhs, const point2d& rhs) {
    return lhs.x_ * rhs.y_ - lhs.y_ * rhs.x_;
}

bool is_orthogonal(const point2d& lhs, const point2d& rhs) {
    return almost_equals(dot(lhs, rhs), 0.0);
}

bool is_parallel(const point2d& lhs, const point2d& rhs) {
    return almost_equals(cross(lhs, rhs), 0.0);
}

class segment {
public:
    segment() : segment(point2d(), point2d()) {}

    segment(const point2d& p1, const point2d& p2) : p1_(p1), p2_(p2) {}

    const point2d& p1() const noexcept { return p1_; }

    const point2d& p2() const noexcept { return p2_; }

private:
    point2d p1_;
    point2d p2_;
};

point2d project(const segment& s, const point2d& p) {
    auto base = s.p2() - s.p1();
    auto r = dot(p - s.p1(), base) / base.squared_l2_norm();
    return s.p1() + base * r;
}

point2d reflect(const segment& s, const point2d& p) {
    return p + (project(s, p) - p) * 2.0;
}

int main() {
#ifdef SUBMIT
    auto& stream = cin;
#else
    string program_input_str = R"(0 0 3 4
3
2 5
1 4
0 3
)";
    stringstream stream(program_input_str);
#endif
    double x1, y1, x2, y2;
    stream >> x1 >> y1 >> x2 >> y2;
    segment s(point2d(x1, y1), point2d(x2, y2));
    int q;
    stream >> q;
    for (int i = 0; i < q; ++i) {
        int px, py;
        stream >> px >> py;
        auto p_reflect = reflect(s, point2d(px, py));
        cout << setprecision(13) << p_reflect.x() << " " << p_reflect.y() << endl;
    }

    return 0;
}


Measured memory_bytes: 3280
#include <bits/stdc++.h>
#define int int64_t
using namespace std;

int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> A(n);
	for (int i=0; i<n; ++i) cin >> A[i];
	vector<vector<pair<int,int>>> dp(n,vector<pair<int,int>>(n));
	vector<int> psum(n+1);
	for (int i=0; i<n; ++i){
		psum[i+1] += A[i];
		psum[i+1] += psum[i];
		dp[i][i] = {A[i],0};
	}
	vector<tuple<int,int,int>> order;
	for (int i=0; i<n; ++i){
		for (int j=i+1; j<n; ++j){
			order.emplace_back(j-i+1,i,j);
		}
	}
	sort(order.begin(),order.end());
	for (auto i:order){
		int a,b,c;
		tie(c,a,b) = i;
		dp[a][b].first = max(dp[a+1][b].second+A[a],dp[a][b-1].second+A[b]);
		dp[a][b].second = psum[b+1] - psum[a] - dp[a][b].first;
	}
/*	for (auto i:dp){
		for (auto j:i) cout << j.first << ' ';
		cout << '\n';
	}
*/	cout << dp[0][n-1].first-dp[0][n-1].second;
	return 0;
}

Measured memory_bytes: 340732
/*
                                                  __          __
      /\   |   |     /\   |  | |  |     /\   | / |  )   /\   |  )
     /__\  |   |    /__\  |--| |  |    /__\  |<  |-<   /__\  |-<
    /    \ |__ |__ /    \ |  | \__/   /    \ | \ |__) /    \ |  \

*/

#import<bits/stdc++.h>
typedef long long ll;
#define num 1e9
#define root 10000
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define forll(i,a,b,c) for(int i=a; i<=b; i+=c)
#define forll2(i,a,b,c) for(int i=a; i>=b; i-=c)
#define pb(n) push_back(n)
#define i(n) insert(n)

using namespace std;

int main()
{
    io;
    int n;
    ll x=0;
    cin>>n;
    int a[n];
    forll(i,0,n-1,1)
    {
        cin>>a[i];
    }
    forll(i,1,n-1,1)
    {
        if(a[i]<a[i-1])
        {
            x+=(a[i-1]-a[i]);
            a[i]=a[i-1];
        }
    }
    cout<<x<<"\n";
}


Measured memory_bytes: 4408
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define ull unsigned long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define meme(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define mod 1'000'000'007
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

int longestCommonSubsequence(string s1, string s2, vector<vector<int>>& dp) 
{
    for (int i = 1; i <= s1.size(); i++) 
    {
        for (int j = 1; j <= s2.size(); j++) 
        {
            if (s1[i-1] == s2[j-1]) 
                dp[i][j] = dp[i-1][j-1] + 1;

            dp[i][j] = max({dp[i][j], dp[i][j-1], dp[i-1][j]});
        }
    }
    return dp[s1.size()][s2.size()];
}

int main()
{
    ios_base::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    cout.tie(NULL) ;
    
    string s1, s2; 
    cin >> s1 >> s2;

    vector<vector<int>> dp(s1.size()+1, vector<int>(s2.size()+1, 0));
    int count = longestCommonSubsequence(s1, s2, dp);   // This will give count of lcs and change the dp vector

    string s = "";
    int i = s1.size(), j = s2.size();
    while (i > 0 && j > 0) 
    {
        if (dp[i-1][j-1] + 1 == dp[i][j] && dp[i-1][j] + 1 == dp[i][j] && dp[i][j-1] + 1 == dp[i][j]) 
        {
            i--; 
            j--; 
            s = s1[i] + s; //As we are travelling backward reverse the string
        }
        else if (dp[i][j-1] > dp[i-1][j]) 
            j--;
        else
            i--;
    }
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 38912
require 'bigdecimal'
require 'bigdecimal/util'
require "bigdecimal/math"
include BigMath

A, B, H, M = gets.chomp.split.map(&:to_d)

theta = BigMath::PI(12) * 2 * (H / 12.0 + ((M / 60.0) / 12.0) - (M / 60.0))

puts BigMath::sqrt(( A**2 + B**2 - (2 * A * B * BigMath::cos(theta,12)) ).abs, 12)

Measured memory_bytes: 14532
#include <stdio.h>

int partition(int *A ,int p ,int r){
  int x = A[r];
  int i = p-1;
  int tmp;
  for(int j=0;j<r;j++){
    if(A[j] <= x){
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;
  return i+1;
}

int main(){
  int n,q;
  int A[100000];

  while(scanf("%d",&n) != EOF){
    char c = ' ';
    for(int i=0;i<n;i++){
      scanf("%d",&A[i]);
    }
    q = partition(A,0,n-1);
    for(int i=0;i<n;i++){
      if(i == n-1)
        c = '\n';
      if(i == q)
        printf("[%d]%c",A[i],c);
      else
        printf("%d%c",A[i],c);
    }
  }
  return 0;
}




Measured memory_bytes: 2992
#include <stdio.h>
#include <float.h>
typedef long long ll;

int main()
{
    ll n, k;
    double ans = 0;
    
    scanf("%lld %lld", &n, &k);

    for (int i = 1; i <= n; i++) {
        ll point = i;
        double x = 1.0 / n;

        while (point < k) {
            point *= 2;
            x /= 2;
        }

        ans += x;
    }

    printf("%.*lf\n", DBL_DIG, ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>

#define FOR0(i,n) for (int i = 0; i < n; i++)
#define FOR(i,j, n) for (int i = j; i < n; i++)
// bool isEven(ll n) {return (n%2!=0)?false:true;};
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll mp::cpp_int
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
// #define int ll

using namespace std;
typedef pair<int, pair<int, int> > ppp;

int a[101];

int main()
{
    int n;
    cin>>n;
    int tot = 0;

    FOR0(i,n){
      cin>>a[i];
      tot+=a[i];  
    } 

    int x = tot/n;

    int res = 0;

    FOR0(i, n) res+=pow(abs(a[i]-x), 2);

    int x2 = x+1;

    int res2 = 0;
    FOR0(i, n) res2+=pow(abs(a[i]-x2), 2);


    cout<<min(res, res2)<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int h,w;
  while(cin >> h >> w && h||w){
    for(int j=0;j<w;j++) cout << "#";
    cout << endl;
    for(int i=1;i<h-1;i++){
      cout << "#";
      for(int j=1;j<w-1;j++) cout << ".";
      cout << "#" << endl;
    }
    for(int j=0;j<w;j++) cout << "#";
    cout << endl << endl;
  }
}

Measured memory_bytes: 1152
#include <stdio.h>

int main() {
	int n, m, c, b[25], a, temp, ans = 0;
	scanf("%d %d %d", &n, &m, &c);
	for (int i = 0; i < m; i++)
		scanf("%d", &b[i]);
	for (int i = 0; i < n; i++) {
		temp = c;
		for (int j = 0; j < m; j++) {
			scanf("%d", &a);
			temp += (a * b[j]);
		}
		if (temp > 0)
			ans++;
	}
	printf("%d\n", ans);
	return 0;
}

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

  using namespace std;

  #define forn(a, e) for (i64 a = 0; a < (i64)(e); a++)
  #define forr(a, s, e) for (int a = s; a < (int)(e); a++)
  #define fore(e, a) for (auto& e : a)

  #ifdef LOCAL
  #define logv(a) {cerr << #a << " = "; fore(e, a) {cerr << e << " ";} cerr << "\n";}
  #define logvp(a) {cerr << #a << " = "; fore(e, a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
  #define logvv(a) {cerr << #a << " = \n"; fore(r, a) { fore(e, r) {cerr << e << " ";} cerr << "\n";} }
  #define logvf(a, field) {cerr << #a"."#field << " = \n"; fore(e, a) { cerr << e.field << " ";} cerr << "\n"; }
  #define logvff(a, f1, f2) {cerr << #a".{"#f1 << ", "#f2 << "} = \n"; fore(e, a) { cerr << "(" << e.f1 <<", " << e.f2 << ") ";} cerr << "\n"; }
  #define logs(a) cerr << #a << " = " << (a) << "\n";
  #define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
  #define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
  #define cond(pred, stmt) if (pred) { stmt }
  #else
  #define logv(a)
  #define logvp(a)
  #define logvv(a)
  #define logvf(a, field)
  #define logvff(a, f1, f2)
  #define logs(a)
  #define logss(a, b)
  #define logp(a)
  #define cond(pred, stmt)
  #endif

  using i64 = long long;
  using iip = pair<i64, i64>;
  using ivec = vector<int>;
  using llvec = vector<i64>;
  using svec = vector<string>;
  template<typename T> using vec = vector<T>;

  template<typename T, typename Dim>
  auto make_vec(T value, Dim dim) { return vector<T>(dim, value); }
  template<typename T, typename Dim1, typename... Dim>
  auto make_vec(T value, Dim1 dim1, Dim... dims) { return make_vec(make_vec(value, dims...), dim1); }

  template<typename T>
  bool uax(T& v, const T& newv) { if (v < newv) { v = newv; return true; } else return false; }
  template<typename T>
  bool uin(T& v, const T& newv) { if (v > newv) { v = newv; return true; } else return false; }

  // template<typename T>
  // istream& operator>>(istream& is, vector<T>& c) { for (auto& e : c) is >> e; return is; }

  // template<typename ...T>
  // istream& read(T&... args) { return (cin >> ... >> args); }

  static mt19937 rande(123123);
  template<typename T>
  T rand_int(T from, T to) { uniform_int_distribution<T> distr(from, to); return distr(rande); }

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

    int x;
    while (cin >> x) {
      int p = x;
      while (true) {
        bool ok = true;
        for (int i = 2; i * i <= p; i++) {
          if (p % i == 0) {
            ok = false;
            break;
          }
        }
        if (ok) {
          break;
        }
        p++;
      }

      cout << p << endl;
    }
  }

Measured memory_bytes: 256
readlines.map(&:split).each do |l|
  a,b,c,d,e,f = l.map(&:to_f)
  puts sprintf("%.3f %.3f", (c*e-f*b)/(a*e-d*b)+0.000, (c*d-f*a)/(b*d-a*e)+0.000)
end

Measured memory_bytes: 6140
import java.util.Scanner;

public class Main {
	public static Scanner sc;
	public static void main(String[] args){
		sc=new Scanner(System.in);
		Double x1=sc.nextDouble(),y1=sc.nextDouble(),x2=sc.nextDouble(),y2=sc.nextDouble();
		Double ans=Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
		System.out.println(ans);
	}

}

Measured memory_bytes: 28112
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,M;
  cin>>N>>M;
  vector<pair<int,int>>A(M);
  for(int i=0;i<M;i++){
  int x,y;
    cin>>x>>y;
    A.at(i).first=x;
     A.at(i).second=y; 
  }
  set<int>S;
  for(int i=0;i<M;i++){
  if(A.at(i).first==1)
    S.insert(A.at(i).second);
  }
  string ans="IMPOSSIBLE";
  for(int i=0;i<M;i++){
  if(A.at(i).second==N && S.count(A.at(i).first)){
   ans="POSSIBLE"; break;
  }
    }cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6528
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy

N, M = map(int, input().split())
print(int(pow(2, M)*(1900*M+100*(N-M))))


Measured memory_bytes: 3828
# coding: utf-8
# Your code here!
s=list(input())
if s.count('N')>0 and s.count('S')>0 and s.count('E')>0 and s.count('W')>0:
    print('Yes')
elif s.count('N')>0 and s.count('S')>0 and s.count('E')==0 and s.count('W')==0:
    print('Yes')
elif s.count('N')==0 and s.count('S')==0 and s.count('E')>0 and s.count('W')>0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>
#include<cstring>
#include <cstdlib>
#include <cstdio>
#include <set>
 
using namespace std;
 
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
const long long mod = 1e9+7;

int main(){
    int n;
    cin >> n;
    long long ans = 1;
    rep(i,n){
        ans = ans * (i+1);
        if (ans >= 1e9+7) ans = ans % mod;
    }
    cout << ans;
    return 0;
}






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

int main()
{
    int n,a,b;
    cin>>n>>a>>b;
    int x = a^b;
    if(x%2==0)
    {
        cout<<"Alice"<<endl;
    }else{
        cout<<"Borys"<<endl;
    }
}

Measured memory_bytes: 3584
import sys

N = int(input())

a = [0]
a += list(map(int, input().split()))

b = [0] * (N+1)

num = 0

for i in range(N, 0, -1):
    sum = 0
    for j in range(i+i, N+1, i):
        if j < len(a):
            sum ^= b[j]
        else:
            break

    b[i] = sum ^ a[i]
    if b[i] == 1:
        num += 1

print(num)

if num == 0 or num == -1:
    sys.exit(0)

flag = False

for i in range(1, N+1):
    if b[i] == 1:
        if flag == True:
            print(" ", end="")
        print(i, end="")
        flag = True

print("")


Measured memory_bytes: 7732
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200010


int main(void) {
	long long dp[N];
	long long h[N];
	deque<long long>q;
	long long n, k;
	long long s;
	long long x, y, z, yy, zz;
	scanf("%lld %lld", &n, &k);
	f(i, n)scanf("%lld", &h[i]);
	dp[0] = 0;
	q.push_back(0);
	s = 1;
	for(long long i=1;i<n;i++) {
		while (s > 1) {
			x = q[0];
			x = dp[x] - (2 * h[x] * h[i]) + (h[x] * h[x]);
			y = q[1];
			y = dp[y] - (2 * h[y] * h[i]) + (h[y] * h[y]);
			if (x < y)break;
			q.pop_front();
			s--;
		}
		x = q[0];
		dp[i] = dp[x] + ((h[i] - h[x])*(h[i] - h[x])) + k;
		q.push_back(i);
		s++;
		while (s > 2) {
			x = q[s - 1];
			y = q[s - 2];
			z = q[s - 3];
			yy = ((h[x] * h[x]) - (h[y] * h[y]) + dp[x] - dp[y])*(h[x] - h[z]);
			zz = ((h[x] * h[x]) - (h[z] * h[z]) + dp[x] - dp[z])*(h[x] - h[y]);
			if (zz < yy)break;
			q.pop_back();
			q.pop_back();
			q.push_back(x);
			s--;
		}
	}
	printf("%lld\n", dp[n - 1]);
}

Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
int main()
{
    ll n;
    cin>>n;
    while(n>0)
    {
        if(n%10==7)
        {
            cout<<"Yes";
            return 0;
        }
        n/=10;
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 3620
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<bits/stdc++.h>
using namespace std;
function<void(void)> ____ = [](){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);};
const int MAXN = 1e6+7;
char s[MAXN];
int ans[MAXN];
typedef int_fast64_t LL;
int main(){
    ____();
    cin >> s+1;
    int n = strlen(s+1);
    memset(ans,255,sizeof(ans));
    s[0] = '>';
    s[n+1] = '<';
    for(int i = 1; i <= n+1; i++){
        if(s[i-1]=='>'&&s[i]=='<'){
            ans[i] = 0;
            for(int j=i-1; j>=1&&s[j]=='>';j--) ans[j] = max(ans[j],ans[j+1]+1);
            for(int j=i+1; j<=n+1&&s[j-1]=='<';j++) ans[j] = ans[j-1] + 1;
        }
    }
    LL tot = 0;
    for(int i = 1; i <= n+1; i++) tot += ans[i];
    cout << tot << endl;
    return 0;
}

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

using namespace std;

const double PI = 3.141592653589;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    int n;
    cin >> n;
    vector<int> v(n), dp(n);
    for(int i=0;i<n;i++)
    {
        cin >> v[i];
    }
    dp[0] = v[0];
    for(int i=1;i<n;i++)
        dp[i] = min(v[i], dp[i-1]);
    int ans = 0;
    for(int i=0;i<n;i++)
    {
        if(v[i] <= dp[i]) 
        {
            ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 3328
S = input()
Q = int(input())

before = [0] * (2 * (10**5))
after = [0] * (2 * (10**5))

count1 = True
before_count = 0
after_count = 0


for i in range(Q):
    q = input().split()
    if int(q[0]) == 1:
        if count1:
            count1 = False
        else:
            count1 = True
    else:
        if int(q[1]) == 1:
            if count1:
                before[before_count] = q[2]
                before_count += 1
            else:
                after[after_count] = q[2]
                after_count += 1
        else:
            if count1:
                after[after_count] = q[2]
                after_count += 1
            else:
                before[before_count] = q[2]
                before_count += 1


for i in range(len(before)):
    if before[i] == 0:
        before = before[:i]
        break

for i in range(len(after)):
    if after[i] == 0:
        after = after[:i]
        break

before = ''.join(before)
after = ''.join(after)

before = before[::-1]
if count1:
    middle = S
    ans = before + middle + after
else:
    middle = S
    ans = before + middle + after
    ans = ans[::-1]

print(ans)



Measured memory_bytes: 77236
#include <cstring>
#include <cstdio>
#include <queue>
using namespace std;

const int S = 20;
const int N = 2e5 + 10;
const int inf = 0x3f3f3f3f;
int n, p[N], bin[30], log[N], st[N][S];
struct data {
	int l, r, x, y;
	data(int _l = 0, int _r = 0, int _x = 0, int _y = 0) {
		l = _l, r = _r, x = _x, y = _y;
	}
	inline bool operator < (const data &a) const {
		return p[x] == p[a.x] ? p[y] > p[a.y] : p[x] > p[a.x];
	}
}; priority_queue <data> q;

inline int query(int l, int r) {
	if (l & 1 ^ 1) l >>= 1, r >>= 1;
	else l = (l/2)+(n/2), r = (r-1)/2+(n/2);
	int d = log[r - l + 1];
	return p[st[r][d]]<p[st[l+bin[d]-1][d]] ? st[r][d] : st[l+bin[d]-1][d];
}

inline void add(int l, int r) {
	int x = query(l, r);
	int y = query(x + 1, r);
	q.push((data){l, r, x, y});
}

template <class T> inline void in(T &x) {
	x = 0; int f = 1; char ch = getchar();
	for (; ch<'0' || ch>'9';) {if (ch=='-') f=-1; ch = getchar();}
	for (; ch>='0' && ch<='9';) x = x*10 + ch-'0', ch = getchar();
	x *= f;
}

inline void init() {
	in(n), bin[0] = 1, memset(p, 0x3f, sizeof p);
	for (int i = 0; i < n; ++i) in(p[i]);
	for (int i = 1; i <= S; ++i) bin[i] = bin[i-1]<<1;
	for (int i = 0; i < n; ++i)
		st[(i/2) + (n/2)*(i%2)][0] = i, log[i] = i<2 ? 0 : log[i>>1]+1;
	for (int i = 1; i < S; ++i)
		for (int j = bin[i]-1, tmp = bin[i-1]; j < n; ++j)
			st[j][i] = p[st[j][i-1]] < p[st[j-tmp][i-1]] ? st[j][i-1] : st[j-tmp][i-1];
}

inline void work() {
	data u;
	for (add(0, n-1); !q.empty();) {
		u = q.top(), q.pop();
		printf("%d %d ", p[u.x], p[u.y]);
		if (u.l < u.x) add(u.l, u.x - 1);
		if (u.r > u.y) add(u.y + 1, u.r);
		if (u.x + 1 < u.y) add(u.x + 1, u.y - 1);
	}
}

int main() {init(), work(); return 0;}

Measured memory_bytes: 19444
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {
    
    int num;
    try ( BufferedReader br =
        new BufferedReader(new InputStreamReader(System.in)) ) {
      num = Integer.parseInt( br.readLine() );

      System.out.println( (int)Math.pow(num, 3));
    } catch( IOException e) {
      System.out.println("IOException!");
    }
  }
}


Measured memory_bytes: 24240
#include <bits/stdc++.h>
#define D(x) cout << #x << "=" << x <<endl; 
#define De(...)
#define pii pair<int,int>
#define mp make_pair<int,int>
using namespace std; 

int _; 

set<int> s;
int n,a[200050],ans=0;
bool vis[1000050];

inline void factor(int x)
{
	if(x == 1)
		return;
	for(int i=1;i*i <= x;i++)
		if(x%i == 0)
		{
			int si=s.size();
			s.insert(i);
			if(si == s.size())
			{
			//	D(x);
			//	D(i);
				ans++;
				return;
			} 
			else
				s.erase(i);
			if(i*i == x || i == 1) 
				continue;
			si=s.size();
			s.insert(x/i);
			if(si == s.size())
			{
			//	D(x);
			//	D(x/i);
				ans++;
				return;
			} 
			else
				s.erase(x/i);
		}
}

int main()
{
	//for(scanf("%d",&_);_;_--)
	for(int i=0;i<1000050;i++)
		vis[i]=false;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		int si=s.size();
		scanf("%d",a+i);
		s.insert(a[i]);
		if(si == s.size())
		{
			if(vis[a[i]]) 
				ans++;
			else
			{
				ans += 2; 
				vis[a[i]]=true;
			}
		} 
	}
	for(int i=0;i<n;i++)
		if(!vis[a[i]])
			factor(a[i]);
	printf("%d\n",n-ans);
	return 0;
}

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

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

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

    return arr
a,b= map(int,input().split())
c=math.gcd(a,b)
if c==1:
  print(1)
else:
  print(len(factorization(c))+1)

Measured memory_bytes: 9344