akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n,k;cin >>n>>k;
    vector<int>a(n);
    ll sum=0;
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
        sum+=a[i];
    }
    unordered_map<ll,int>mp;
    for (ll i = 1; i*i<=sum; ++i) {
        if(sum%i==0){
            mp[i]++;
            mp[sum/i]++;
        }
    }
    auto add=[&](ll x){
        vector<int>r;
        for (int i = 0; i < n; ++i) {
            if(a[i]%x){
                r.push_back(a[i]%x);
            }
        }
        if(r.empty())return true;
        int m=r.size();
        sort(all(r));
        vector<ll>fsum(m+1,0);
        vector<ll>rsum(m+1,0);
        for (int i = 0; i < m; ++i) {
            fsum[i+1]=fsum[i]+r[i];
            rsum[m-i-1]=rsum[m-i]+(x-r[m-i-1]);
        }
//        cout <<x<<endl;
//        for (int i = 0; i <=m; ++i) {
//            cout <<rsum[i]<<" ";
//        }
//        cout <<endl;
        for (int i = 0; i <=m; ++i) {
//            cout <<x<<" "<<fsum[i]<<" "<<rsum[i]<<endl;
            if(fsum[i]==rsum[i]&&fsum[i]<=k)return true;
        }
        return false;
    };
    ll ans=0;
    for(auto p:mp){
        if(add(p.first))ans=max(ans,p.first);
    }
    cout <<ans <<endl;
}

Measured memory_bytes: 3644
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

d = {
    'SUN': 7,
    'MON': 6,
    'TUE': 5,
    'WED': 4,
    'THU': 3,
    'FRI': 2,
    'SAT': 1,
}
s = rs()
print(d[s])

Measured memory_bytes: 3064
import java.util.HashSet;
import java.util.Set;

public class Main {
  private static void solve() {
    int n = ni();
    Set<Long> set = new HashSet<>();
    for (int i = 0; i < n; i ++) {
      long x = nl();
      if (set.contains(x)) {
        set.remove(x);
      } else {
        set.add(x);
      }
      
    }
    System.out.println(set.size());
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = System.getProperty("debug");
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}




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

int main() {

    string S;
    cin >> S;

    bool yymm = true;
    bool mmyy = true;

    if (stoi(S.substr(0, 2)) > 12 || stoi(S.substr(0, 2)) == 0) {
        mmyy = false;
    }
    if (stoi(S.substr(2, 2)) > 12 || stoi(S.substr(2, 2)) == 0) {
        yymm = false;
    }

    if (yymm) {
        if (mmyy) {
            cout << "AMBIGUOUS" << endl;
        }
        else {
            cout << "YYMM" << endl;
        }
    }
    else {
        if (mmyy) {
            cout << "MMYY" << endl;
        }
        else {
            cout << "NA" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
/*
	Author GaryMr
	线段树：左闭右开！ 
	代数设出每个值寻找关系？
	优先队列：priority_queue<类型> q;   
	priority_queue<vector<类>, less<类> > pq1; 　　　 // 使用递减less<int>函数对象排序
	priority_queue<vector<类>, greater<类> > pq2; 　　// 使用递增greater<int>函数对象排序
*/
#include<bits/stdc++.h>
using namespace std;
map<int,int> m;
typedef pair<pair<int,int>,pair<int,int> > mpair;
set<mpair> q; 
pair<int,int> Jtree[1600001],Otree[1600001];//[r,l)
int n,p[400001];
void build(int k,int l,int r){
//	cout<<k<<" "<<l<<  " "<<r<<endl;
	if(l==r-1){
		Jtree[k]=Otree[k]={0x3f3f3f3f,l};
		if(l%2) Jtree[k]={p[l],l};
		else Otree[k]={p[l],l};
		return;
	}
	int mid=(l+r)>>1;
	build(k*2,l,mid);
	build(k*2+1,mid,r);
	Jtree[k]=min(Jtree[k*2],Jtree[k*2+1]);
	Otree[k]=min(Otree[k*2],Otree[k*2+1]);
}
pair<int,int> getJ(int k,int a,int b,int l,int r){
	if(r<=a||l>=b) return {0x3f3f3f3f+1,l};
	if(r<=b&&l>=a) return Jtree[k];
	int mid=(l+r)>>1;
	return min(getJ(k*2,a,b,l,mid),getJ(k*2+1,a,b,mid,r));
}
pair<int,int> getO(int k,int a,int b,int l,int r){
	if(r<=a||l>=b) return {0x3f3f3f3f+1,l};//cout<<k<<" "<<a<<" "<<b<<" "<<l<<" "<<r<<endl;
	if(r<=b&&l>=a) return Otree[k];
	int mid=(l+r)>>1;
	return min(getO(k*2,a,b,l,mid),getO(k*2+1,a,b,mid,r));
}
pair<int,int> getminima(int l,int r){
	pair<int,int> fir,sec;
	if(l%2) {fir=getJ(1,l,r,1,n+1);sec=getO(1,fir.second+1,r,1,n+1);}
	else {fir=getO(1,l,r,1,n+1);sec=getJ(1,fir.second+1,r,1,n+1);}
	return {fir.first,sec.first};
}
int main(){
	int FinalN;
	scanf("%d",&n);FinalN=n; 
	for(int i=1;i<=n;i++) {
		scanf("%d",&p[i]);m[p[i]]=i;
	}
	n=(1<<int(ceil(double(log2(double(n))))));
	for(int i=1;i<=n;i++){
		if(!p[i]){
			p[i]=0x3f3f3f3f;
		}
	}
	build(1,1,n+1);
	q.insert({{getminima(1,n+1)},{1,n+1}});
	while(q.size()){
		mpair process=*q.begin();
		q.erase(q.begin());
		if(process.second.first>FinalN) continue;
		printf("%d %d ",process.first.first,process.first.second);
		int l=process.second.first,r=process.second.second,firwei=m[process.first.first],secwei=m[process.first.second];
		if(firwei>l){
			
			q.insert({{getminima(l,firwei)},{l,firwei}});
		}
		if(secwei>firwei+1){//cout<<firwei+1<<" "<<secwei<<endl;
			q.insert({{getminima(firwei+1,secwei)},{firwei+1,secwei}});
		}
		if(r>secwei+1){
			q.insert({{getminima(secwei+1,r)},{secwei+1,r}});
		}
	} 
	return 0;
} 

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

int main(){
  int n, count = 1, a, min;
  cin >> n >> min;
  Srep(i,1,n){
    cin >> a;
    if(min > a){
      min = a;
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3556
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
using namespace std;

const int64_t M = 1'000'000'007;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);

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

    static uint32_t dp[1<<21][22];
    for(int j=0;j<=n;j++){
        for(uint ptn=0;ptn<(1<<n);ptn++){
            if(j == 0){
                dp[ptn][j] = 1;
                continue;
            }
            dp[ptn][j] = 0;
            uint mask = ptn & a[j-1];
            mask |= 1<<n;
            for(uint k=(mask & -mask);k<(1<<n);k=(mask & -mask)){
                dp[ptn][j] += dp[ptn & ~k][j-1];
                dp[ptn][j] %= M;
                mask &= ~k;
            }
        }
    }

    cout << dp[(1<<n)-1][n] << endl;
    
    return 0;
}


Measured memory_bytes: 180480
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		if (a < b && b < c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 26036
#include<stdio.h>
int main(){
  int a[10]={0} ,i ,j ,n ,cnt;
  double student[50];
  scanf( "%d",&n );
  for( i=0 ; i<n ; i++ ){
    scanf( "%lf",&student[i] );
    
    if( student[i] < 165.0 ){
      a[1]++;
    }
    
    else if( student[i] >= 165.0 && student[i] < 170.0 ){
      a[2]++;
    }
    
    else if( student[i] >= 170.0 && student[i] < 175.0 ){
      a[3]++;
    }
    else if( student[i] >= 175.0 && student[i] < 180.0 ){
      a[4]++;
    }
    else if( student[i] >= 180.0 && student[i] < 185.0 ){
      a[5]++;
    }
    else if( student[i] >= 185.0 ){
      a[6]++;
    }
  }
  
  for( i=1 ; i<=6 ; i++ ){
    printf( "%d:",i );
    if( a[i] != 0 ){
      for( j=0 ; j<a[i] ; j++ ){
	printf( "*" );
      }
    }
    printf( "\n" );
  }
    
  return 0;
}

Measured memory_bytes: 636
/* ex3_4
   key_tree */

#include <stdio.h>

// Nを1-9で割った商が1-9かつ余りが0になればよい
int main(void) {
  int N;
  scanf("%d", &N);
  int i = 1;
  // 1-9まで調べる
  while(i < 10){
    int quotient = N / i;
	int remainder = N % i;
    //商が1-9かつ余り0
    if(quotient >= 1 && quotient <= 9 && remainder == 0){
	  printf("Yes\n");
	  break;/*当てはまったらwhile脱出*/
	}
	i += 1;
  }
  if(i == 10){
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(1,n-1):
    b=a[i-1:i+2]
    #print(b,sorted(b),b[1],sorted(b).index(b[1]))
    if sorted(b).index(b[1])==1:
        cnt+=1
print(cnt)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
long double pi = 2 * acos(0.0);
const ll mod = 1e9 + 7;

void solve() {
    string s, t;
    cin >> s >> t;
    ll ans = 0;
    for(ll i = 0; i < s.size(); i++) {
        if(s[i] != t[i]) ans++;
    }
    cout << ans;
}

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

Measured memory_bytes: 3800
N = int(input())

def func(N):
	for i in range(7, 0, -1):
		if 2**i <= N:
			print(2 ** i)
			break
	else:
		print(N)

#for i in range(1, 100 + 1):
#	print(i, ":", end="")
#	func(i)

func(N)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
/*#include<iostream>
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<climits>*/
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define rep1(i,a,b) for(int i=a;i<=(b);++i)
#define per(i,a,b) for(int i=a;i>(b);--i)
#define per1(i,a,b) for(int i=a;i>=(b);--i)
#define LL long long
#define inf 0x7f7f7f7f
#define N 10010
using namespace std;
int a[N];
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    int i=0;
    while(~scanf("%d",&a[i++]));
    sort(a,a+i-1,cmp);
    printf("%d\n%d\n%d\n",a[0],a[1],a[2]);
}


Measured memory_bytes: 3236
#include <stdio.h>

int binarySearch(int *S, int n, int t)
{
	int head, mid, tail;

	head = 0;
	tail = n - 1;
	while (head <= tail)
	{
		mid = head + (tail - head) / 2;
		if (S[mid] == t) return 1;
		if (S[mid] < t) head = mid + 1;
		else tail = mid - 1;
	}

	return 0;
}

int main()
{
	int c, i, n, q, t;
	int S[100000];

	scanf("%d", &n);
	for (i = 0; i < n; i++) scanf("%d", &S[i]);

	c = 0;
	scanf("%d", &q);
	for (i = 0; i < q; i++)
	{
		scanf("%d", &t);
		c += binarySearch(S, n, t);
	}

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

	return 0;
}

Measured memory_bytes: 2092
/****************************
    > File Name: a.cpp
    > Author: caoyu01
  	> Mail: yalecyu@gmail.com 
    > Created Time: 2016年10月15日 星期六 20时05分53秒
*****************************/
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define cle(x) memset(x,0,sizeof(x))
#define rep(i,x) for(int i=0;i<x;i++)
#define Rep(i,x) for(int i=1;i<=x;i++)
const int N = 1000+10;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
int num[N];
int main()
{
#ifndef ONLINE_JUDGE
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
#endif
	int a,b,c;
	while(cin>>a>>b>>c){
		cle(num);
		num[a]++;
		num[b]++;
		num[c]++;
		int ans=0;
		rep(i,101)if(num[i])ans++;
		cout<<ans<<endl;
	}
	return 0;
}


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

const ll INF = 1e17;
const ll MOD = 1e9+7;

int main() {
    // input, ready
    string S;
    cin >> S;
    int Slength = S.length();

    //resolve
    int ans=0;
    for (int i=0; i < Slength/2; i++)
    {
        if (S[i] != S[Slength-i-1]) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    long long A;
    cin>>A;
    double B;
    cin >>B;
    long long b =  (A / 100);
    long long s = A % 100;
    long long ab = b * (long long)(B * 100.0001);
    double as = s * B;
    cout << ab + (long long)as << endl;

}


Measured memory_bytes: 3632
using System;
using System.Linq;
using System.Text;

namespace Heaps
{
    class Maximum_Heap
    {
        static void MaxHeapify(int[] A, int index)
        {
            var r = index << 1;
            var l = r - 1;
            index--;
            var largest = 0;
            if (l < A.Length && A[l] > A[index]) largest = l;
            else largest = index;
            if (r < A.Length && A[r] > A[largest]) largest = r;

            if (largest != index)
            {
                var temp = A[index];
                A[index] = A[largest];
                A[largest] = temp;
                MaxHeapify(A, largest+1);
            }
        }

        static void BuildMaxHeap(int[] A)
        {
            for (int i = A.Length / 2; i > 0; i--)
                MaxHeapify(A, i);
        }

        static void Main(string[] args)
        {
            Console.ReadLine();
            var A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            BuildMaxHeap(A);
            var str = new StringBuilder();
            for (int i = 0; i < A.Length; i++)
            {
                str.Append(" ").Append(A[i]);
            }
            Console.WriteLine(str.ToString());
        }
    }
}

Measured memory_bytes: 65940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define Little 1
const long long INF = 1LL<<60;
#define pairint pair<int,int>
signed main(){
  int x=0,y=0,z=0,k=0;
  std::cin >> x>>y>>z>>k;
  if(x>=k)std::cout << k << '\n';
  else if(x+y>=k)std::cout << x << '\n';
  else if(x+y+z>=k)std::cout << x-(k-x-y) << '\n';
}


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

int main() {
    int n; cin >> n;
    vector<int> l(n*2);
    for (int i=0; i<2*n; ++i) cin >> l[i];
    sort(l.begin(), l.end());
    int ans = 0;
    for (int i=0; i<2*n; i+=2) {
        ans += l[i];
    }
    cout << ans << endl;
}

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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int a, b;
	int c, d;
	cin >> a >> b >> c >> d;
	cout << min(a, b) + min(c, d);
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    K = int(readline())

    cur = 1

    for _ in range(N):
        cur = min(2 * cur, cur + K)

    print(cur)


if __name__ == '__main__':
    main()


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

using namespace std;
using ll = long long;
constexpr int INF = numeric_limits<int>::max();
template <typename T, typename... Args>
const T& min(const T& a, Args... args) {
  return min(a, min(args...));
}
template <typename T, typename... Args>
const T& max(const T& a, Args... args) {
  return max(a, max(args...));
}

#pragma GCC optimize("O3")
static const auto __ = [] {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  return nullptr;
}();

int main(int argc, char* argv[]) {
  ll n;
  cin >> n;
  ll ans = n - 1;
  for (ll a = 1; a * a <= n; ++a) {
      if (n % a == 0) {
        ans = min(ans, a + (n / a) - 2);
      }
  }
  cout << ans << '\n';
  return 0;
}

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

class Main {
	public static final int M = 48828125;
	public static boolean[] H = new boolean[M];	
    public static void main( String[] args ) {
        try {
 	      	BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
			StringBuilder output = new  StringBuilder( );
        	int n = Integer.parseInt( kb.readLine( ) );
			String[] str = new String[3];
			for( int i=0; i<n; i++ ) {
				str = kb.readLine( ).split( " " );
				if( "insert".equals( str[0] ) ) {
					insert( str[1] );
				} else if( "find".equals( str[0] ) ) {
					if( find( str[1] ) ) {
						output.append( "yes\n" );
					} else {
						output.append( "no\n" );
					}
				}
			}
			System.out.print( output );
        } catch( IOException e ) {
            System.err.println( e );
        }
    }
    
   public static int getChar( char ch )
   {
		if( ch == 'A') {
			return 1;
		} else if( ch == 'C') {
			return 2;
		} else if( ch == 'G') {
			return 3;
		} else if( ch == 'T') {
			return 4;
		}
		return 0;
	}
	public static int getKey( String str )
	{
		int i;
		int key = 0, base = 1;
		char[] str2 = str.toCharArray() ;
		for ( i=0; i<str.length( ); i++ ) {
			key += base*( getChar( str2[i] ) );
			base *= 5;
		}
		return key;
	}
	
	public static boolean find( String str )
	{
		if( true == H[ getKey( str ) ] ) {
			return true;
		} else {
			return false;
		}
	}
	
	public static void insert( String str )
	{
		H[ getKey( str ) ] = true;
		return;
	}	
}

Measured memory_bytes: 339156
import sys
import numpy as np
import decimal
ary = input().split()
#print(a)

a = int(ary[0])
b = int(ary[1])
c = int(ary[2])

#print(np.sqrt(decimal.Decimal(a)))
#print(np.sqrt(decimal.Decimal(b)))
#print(np.sqrt(decimal.Decimal(a)) + np.sqrt(decimal.Decimal(b)))
#print(np.sqrt(decimal.Decimal(c)))


if (np.sqrt(decimal.Decimal(a)) + np.sqrt(decimal.Decimal(b))) < np.sqrt(decimal.Decimal(c)):
  print('Yes')
else:
  print('No')


Measured memory_bytes: 13524
n, k = map(int, input().split())

MOD = 10**9 + 7

def cmb(n, r, mod=10**9 + 7):
        if r < 0 or r > n:
            return 0
        r = min(r, n - r)
        return g1[n] * g2[r] * g2[n - r] % mod

def make_table(n, mod=10**9 + 7):
    # 元テーブル
    g1 = [0] * (n + 1)
    g1[0] = 1
    g1[1] = 1

    # 逆元テーブル
    g2 = [0] * (n + 1)
    g2[0] = 1
    g2[1] = 1

    # 逆元計算用テーブル
    inverse = [0] * (n + 1)
    inverse[0] = 0
    inverse[1] = 1

    for i in range(2, n + 1):
        g1[i] = (g1[i - 1] * i) % mod
        inverse[i] = (-inverse[mod % i] * (mod // i)) % mod
        g2[i] = (g2[i - 1] * inverse[i]) % mod

    return tuple(g1), tuple(g2), tuple(inverse)

g1, g2, inverse = make_table(2*n)

# n! (MOD p)
def factorial_mod(n, p = MOD):
    tmp = 1
    for i in range(1, n+1):
        tmp *= i
        tmp %= p
    return tmp

if n-1 <= k:
    print(cmb(2*n-1, n-1))
else:
    ans = 1
    for n_empty in range(1, k+1):
        ans += cmb(n, n_empty) * cmb(n-1, n-1-n_empty)
        ans %= MOD
    print(ans)

Measured memory_bytes: 59892
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;


int main(){
    char A;
    cin >> A;
    if(A == 'A'){
        cout << 'T' << endl;
    }
    else if(A == 'T'){
        cout << 'A' << endl;
    }
    else if(A == 'C'){
        cout << 'G' << endl;
    }
    else{
        cout << 'C' << endl;
    }
}

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

int	main() {
	int	N;
	long	M;
	cin >>N >>M;
	vector<long> A(N+1);
	A.at(0)=0;
	long A0=0, A1;
	for (int i=1; i<=N; i++) {
      cin >>A1;
      A.at(i)=A0=(A0+A1)%M;
    }
	sort(A.begin(), A.end());
	vector<vector<long>> B(0);
	B.push_back({0, 1});
	for (int i=1; i<=N; i++)
		if (A.at(i)==A.at(i-1)) B.back().at(1)++;
		else B.push_back({A.at(i), 1});
	long S =0;
	for (int i=0; i<B.size(); i++) S += B.at(i).at(1)*(B.at(i).at(1)-1)/2;
	cout << S << endl;
	return 0;
}



Measured memory_bytes: 4532
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define pf printf
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node

using namespace std;
///check n=1;
///check corner case;

int main()
{
    ll a,b;
    cin>>a>>b;
    ll c=__gcd(a,b);
    ll ans=a*b/c;
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

int main() {
    long long sum = 0;
    int N;
    cin>>N;
    vector<long long int> v(N);
    for(int c=0;c<N;c++) cin>>v[c];
    sum = accumulate(v.begin(),v.end(),0LL);

    long long gauche = 0;
    long long res = sum;
    for(int c=0;c<N;c++) {
        gauche += v[c];
        sum -= v[c];
        res = min(abs(gauche-sum),res);
    }
    cout<<res;
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
 
int main(){
    int n;
    int a[10000];
    long long int max = -1000000, min = 1000000, sum = 0;
    cin >> n;
    for (int i = 0; i <n;i++){
        cin >> a[i];
        if (a[i]>max) max = a[i];
        if (a[i]<min) min = a[i];
        sum += a[i];
    }
    cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3124
#include <iostream>
#include <string>
#define NIL 3000000000
using namespace std;

class node{
public:
  long long int num;
  node* parent;
  node* left;
  node* right;

  node(){
    num = NIL;
    parent = NULL;
    left = NULL;
    right = NULL;
  }

  node(long long int n){
    num = n;
    parent = NULL;
    left = NULL;
    right = NULL;
  }

  void insert(long long int n){
    if(num==NIL) num=n;
    //値が小さいとき
    if(n<num){
      if(left==NULL){
        left = new node(n);
        left->parent=this;
      }else{
        left->insert(n);
      }

    //値が大きいか等しいとき
    }else if(n>num){
      if(right==NULL){
        right = new node(n);
        right->parent=this;
      }else{
        right->insert(n);
      }
    }else return;
  }

  void print_inorder(){
    if(left!=NULL) left->print_inorder();
    if(num!=NIL) cout << " " << num;
    if(right!=NULL) right->print_inorder();
  }

  void print_preorder(){
    if(num!=NIL) cout << " " << num;
    if(left!=NULL) left->print_preorder();
    if(right!=NULL) right->print_preorder();
  }

  bool find(long long int n){
    if(num==NIL) return false; //値が存在しないとき
    if(n<num){
      if(left==NULL) return false;
      else return left->find(n);
    }
    else if(n==num) return true;
    else if(n>num){
      if(right==NULL) return false;
      else return right->find(n);
    }
  }
};

/*
class root{
public:
  node* rn;

  root(){
    rn = NULL;
  }

  void insert(long long int n){
    if(rn==NULL){
      node r(n);
      rn = &r;
    }else rn->insert(n);
  }

  void print(){
    if(rn==NULL) return;
    else rn->print();
  }
};
*/

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

  node bst;

  string m; long long int num;
  for(int i=0; i<n; i++){
    cin >> m;
    if(m[0]=='i') {
      cin >> num;
      bst.insert(num);
    }
    else if(m[0]=='f'){
      cin >> num;
      if(bst.find(num)) cout << "yes" << endl;
      else cout << "no" << endl;
    }
    else if(m[0]=='p') {
      bst.print_inorder(); cout << endl;
      bst.print_preorder(); cout << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 21808
#include "bits/stdc++.h"

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, U b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, U b){ return b > a ? a = b, true : false; }

ll n, res = 0;
vector<ll> a;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    a.assign(n, 0);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    for(int i = 1; i < n; ++i){
        if(a[i] < a[i - 1]){
            res += a[i - 1] - a[i];
            a[i] = a[i - 1];
        }
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 4788
#include<iostream>

using namespace std;

typedef long long ll;

int main(){
	ll N; cin >> N;
	for(ll h = 1; h <= 3500; h++) for(ll n = 1; n <= 3500; n++){
		if(4 * h * n - N * n - N * h <= 0) continue;
		if(N * h * n % (4 * h * n - N * n - N * h) == 0){
			cout << h << " " << n << " " << N * h * n / (4 * h * n - N * n - N * h) << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

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

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}
const int INF=5e8;
int n,m;
int g[705][705];
int col[705];

bool dp[705];

int cnt[2];
bool fail;
void dfs(int v,int c){
  col[v]=c;
  ++cnt[c];
  REP(i,n) if(g[v][i]==0 && i!=v){
    if(col[i]==-1){
      dfs(i,1-c);
    }else if(col[i]!=1-c){
      fail=true;
    }
  }
}
int main(){
  cin>>n>>m;
  REP(i,m){
    int a,b;scanf("%d%d",&a,&b);--a;--b;
    g[a][b]=g[b][a]=1;
  }
  memset(col,-1,sizeof(col));
  int off=0;
  vector<int> sz;
  REP(i,n) if(col[i]==-1){
    cnt[0]=cnt[1]=0;
    dfs(i,0);
    int mn=min(cnt[0],cnt[1]),mx=max(cnt[0],cnt[1]);
    off+=mn;
    if(mn!=mx) sz.pb(mx-mn);
  }
  if(fail){
    puts("-1");
    return 0;
  }

  dp[off]=1;
  for(auto e:sz){
    for(int j=n;j>=0;--j) if(dp[j]) dp[j+e]=true;
  }

  int res=INF;
  REP(i,n+1) if(dp[i]){
    auto sq=[&](int k){
      return k*(k-1)/2;
    };
    chmin(res,sq(i)+sq(n-i));
  }
  cout<<res<<endl;
  return 0;
}





Measured memory_bytes: 2176
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

def solve():
    H, W = map(int, raw_input().split())
    a = [list(raw_input()) for i in xrange(H)]

    cnt = [0]*26
    for ai in a:
        for c in ai:
            cnt[ord(c) - ord("a")] += 1
    if H%2 == 0 and W%2 == 0:
        for i in xrange(26):
            if cnt[i]%4 != 0:
                return False
        return True
    elif H%2 == 0 or W%2 == 0:
        for i in xrange(26):
            if cnt[i]%2 != 0:
                return False
            cnt[i] /= 2
        X = W/2 if W%2 == 0 else H/2
        odd = sum(cnt[i]%2 != 0 for i in xrange(26)) 
        return odd <= X 
    else:
        odd = sum(cnt[i]%2 != 0 for i in xrange(26)) 
        four = sum(cnt[i]/4 for i in xrange(26))
        return odd == 1 and four >= (H/2)*(W/2)

print "Yes" if solve() else "No"


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

const ll     mod = 1e9+7;
const double eps = 1e-9;


int h,w;
const int N=1002;
ll a[N][N],dp[N][N];

void solve(){
    cin >> h >> w;
    for(int i=1;i<=h;++i) {
        for(int j=1;j<=w;++j) {
            char t;
            cin >> t;
            a[i][j] = (t=='.'?1:0);
        }
    }
    bool flag=1;
    for(int i=1;i<=h&&flag;++i)
        if(a[i][1])
            dp[i][1]=1;
        else 
            flag=0;
    flag=1;
    for(int i=1;i<=w&&flag;++i) {
        if(a[1][i])
            dp[1][i]=1;
        else 
            flag=0;
    }

    for(int i=2;i<=h;++i) {
        for(int j=2;j<=w;++j) {
            if(!a[i][j])
                dp[i][j]=0;
            else 
                dp[i][j] = (dp[i-1][j]%mod + dp[i][j-1]%mod)%mod;
        }
    }

    cout << dp[h][w] << "\n";

}


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


Measured memory_bytes: 19200
s = int(input())
ss = list()
ss += [s]
ans = 1
for i in range(1000000000):    
    if s%2 == 0:
        s = s//2
    else:
        s = 3*s+1
    ss += [s]
    ans +=1
    if s in ss[:-1]:
        print(ans)
        break
    

Measured memory_bytes: 2940
N, M = map(int, input().split())
X = [None] * N

if N == 1 and M == 0:
    print(0)
    exit()

order_list = []

for _ in range(M):
    s, c = map(int, input().split())
    if N != 1 and s == 1 and c == 0:
        print(-1)
        exit()
    for o in order_list:
        if o[0] == s and o[1] != c:
            print(-1)
            exit()
    else:
        order_list.append([s,c])
        X[s-1] = str(c)

f = False
for i in range(N):
    if X[i] == None and f == False:
        X[i] = "1"
        f = True
    elif X[i] == None and f == True:
        X[i] = "0"
    elif X[i] != None and f == False:
        f = True

print("".join(X))


Measured memory_bytes: 3064
// Created by arvybhatt

#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define p_b push_back
#define m_p make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)

using namespace std;
using ll = long long;

int main()
{
    fast;
    ll n;cin>>n;
    ll a[n][3];
    for(int i=0; i<n; i++)
    	cin>>a[i][0]>>a[i][1]>>a[i][2];
    for(int i=1; i<n; i++)
    {
    	a[i][0]+=max(a[i-1][1],a[i-1][2]);
    	a[i][1]+=max(a[i-1][0],a[i-1][2]);
    	a[i][2]+=max(a[i-1][0],a[i-1][1]);

    }
   cout<<max(a[n-1][0],max(a[n-1][1],a[n-1][2]));
    

    
    return 0;
}


Measured memory_bytes: 2560
//template by I_Love_Totoro, inspired by chamow
//Doing VC Everyday #SpecialistByMarch
//refer cook_book and AC  of/Ubuntu folder _FunWithCP_ dated:16/03/2020- for POC and more insights respectively
//interactive comments ahead! : for the love of CP <3
//note to self:for the love of everything good, uncomment fastread whenever applicable :) 

/* footnotes/ obs
*
*/

/*main idea:
*
*/

/*similar to:
*
*/

/*re-learnt/ got better clarity
*
*/

/*corollary
*
*/

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define repn(i,a,n) for(i=n;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define PI (atan(1)*4)
#define INF (int)1e9

#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
//typedef vec vector<ll>
typedef long long ll;
typedef long double ld;
typedef long int li;

using namespace std;

ll lcm(ll val1,ll val2)
{
	if(val1==0||val2==0)
		return 0;
	else
		return (val1*val2)/__gcd(val1,val2);
}

ll pw(ll base,ll p)
{
	if(base==1||p==0)				
		return 1;
	if(p%2==0){
		ll interm=pw(base,p/2);
		return interm*interm;

	}
	else
		return base*pw(base,p-1);

}

int main()
{

	//fastread;
	/*
	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    */
	
	ll n,x;
	cin>>n;
	vector<ll>vec,dp(n,1e10),ans(n,0);

	for (ll i = 0; i < n; i ++) {
		cin>>x;
		vec.pb(x);
	}

	dp[0] = 0;//vec[0];
	ans[0] = dp[0];
	dp[1] = abs(vec[1]-vec[0]);
	ans[1] = dp[1];

	ll ansr = 0, k = 2;
	for (ll i = 2; i < n; i++){
		//dp[i] += min(abs(vec[i] - vec[i-1]),abs(vec[i] - vec[i-2]));
		/*if (abs(vec[i]-vec[i-1])<abs(vec[i]-vec[i-2]))
			dp[i] += abs(vec[i] - vec[i-1]) + dp[i-1];
		//else
			dp[i] += abs(vec[i] - vec[i-2]) + dp[i-2];
		//ansr += dp[i];*/
		
		/*ans
		dp[i] = min(dp[i],min(dp[i-1] + abs(vec[i]-vec[i-1]),dp[i-2] + abs(vec[i] - vec[i - 2])));
		*/

		for (ll j = 1; j <= k && i - j >= 0; j ++)
			dp[i] = min(dp[i], dp[i-j] + abs(vec[i] - vec[i-j]));
	}

	//for (ll i = 0; i < n; i ++)
	//	cout<<dp[i]<<" ";
	//cout<<"\n";

	cout<<dp[n-1]<<"\n";
	//cout<<ansr<<"\n";
	return 0;
}

Measured memory_bytes: 2936
# coding: utf-8
import sys


def main(argv=sys.argv):
  a = int(input())
  b = int(input())
  c = int(input())
  x = int(input())
  
  ans = 0
  
  for i in range(a+1):
    for j in range(b+1):
      for k in range(c+1):
        if (500*i + 100*j + 50*k) == x:
          ans += 1
  
  print(ans)
  
  return 0


if __name__ == '__main__':
  sys.exit(main())

Measured memory_bytes: 3188
#include<stdio.h>
#include<string.h>
int main()
{
  long n,i,ac=0,wa=0,tle=0,re=0;
  scanf("%ld",&n);
  char r[5];
  for(i==0;i<n;i++)
  {
    scanf("%s",r);
    if(strcmp(r,"AC")==0)
    {
      ++ac;
    }
    else if(strcmp(r,"WA")==0)
    {
      ++wa;
    }
    else if(strcmp(r,"TLE")==0)
    {
      ++tle;
    }
    else
    {
      ++re;
    }
  }
  printf("AC x %ld\nWA x %ld\nTLE x %ld\nRE x %ld\n",ac,wa,tle,re);
}

Measured memory_bytes: 1700
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)

const long long  int INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
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; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
#define COUT(x) cout<<x<<"\n"
class UnionFind{
public:
	vector<int> par;	// par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
	vector<int> rank;	//ランク
	vector<ll> diff_weight;

	UnionFind(int N=1,int SUM_UNITY=0){
		par.resize(N),	rank.resize(N),	diff_weight.resize(N);
		for (int i = 0; i < N; ++i) par[i] = i,rank[i]=0,diff_weight[i]=SUM_UNITY;
	}
	int root(int x){// データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if(par[x]==x)return x;
		else{
			int r=root(par[x]);
			diff_weight[x]+=diff_weight[par[x]];	//累積和を取る
			return par[x]=r;
		}
	};

	bool issame(int x,int y){
		return(root(x)==root(y));
	};

	// weight(ry)-weight(rx)=wとなるようにmergeする
	bool merge(int x,int y,int w){
		w+=weight(x);		//rootとの重み差分を補正
		w-=weight(y);
		int rx = root(x); 	//xの根をrx
		int ry = root(y); 	//yの根をry
		if (rx == ry) return false; //xとyの根が同じ(=同じ木にある)時はそのまま
		if(rank[rx]<rank[ry])	swap(rx, ry),w=-w;// rank[rx] >= rank[ry] となるように rx と ry を swap (それに合わせて w も符号反転します)
		if (rank[rx] == rank[ry]) ++rank[rx];// y (のroot) を x (のroot) の下にくっつける
		par[ry] = rx; 		//xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		diff_weight[ry]=w;	// x が y の親になるので、x と y の差分を diff_weight[y] に記録
		return true;
	}
	ll weight(int x){
		root(x);	//経路圧縮
		return diff_weight[x];
	}
	int diff(int x,int y){
		return weight(y)-weight(x);
	}
};

void Main()
{
	ll N,M;
	ll result=0;
	cin>>N>>M;
	ll l,r;
	UnionFind uni(N);
	VI p(N);
	REP(i,N) cin>>p[i];
	REP(i, M)
	{
		cin >> l>>r;
		l--,r--;
		uni.merge(l,r,0);
	}
	REP(i,N){
		if(uni.issame(p[i]-1,i))
			result++;
	}
	COUT(result);
	return;
}

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


Measured memory_bytes: 2560
import sys
sys.setrecursionlimit(600000)

N = int(input())

graph = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

def dfs(p, checked, now):
    #print(p, checked, now)
    if p == N-1:
        return now, True
    ok = False
    for q in graph[p]:
        if not checked[q]:
            now.append(q)
            checked[q] = True
            nbw, ok1 = dfs(q, checked, now)
            if ok1:
                bw = nbw
                ok = True
    if not ok:
        now.pop()
        return now, False
    return bw, True

checked = [False for _ in range(N)]
checked[0] = True
bw, ok = dfs(0, checked, [0])
#print(bw)

between = [0 for _ in range(N)]
k = len(bw)
if k % 2 == 0:
    s0 = bw[k//2-1]
    sN = bw[k//2]
else:
    s0 = bw[k//2]
    sN = bw[k//2+1]
between[s0] = True
between[sN] = True

def dfs2(p, checked, c):
    c += 1
    for q in graph[p]:
        if not checked[q]:
            checked[q] = True
            c = dfs2(q, checked, c)
    return c

c0 = dfs2(s0, between, 0)
cN = dfs2(sN, between, 0)
#print(c0, cN)



if cN < c0:
    print('Fennec')
else:
    print('Snuke')

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

int main() {
  int i;
  long long n,a = 0,max;
  cin >> n;
  vector<long long> h(n),v;
  for(i = 0; i < n; i++) cin >> h.at(i); 
  for(int j = 0; j < n - 1; j++){
    if(h.at(j) >= h.at(j + 1)) {
      a++;
    }else{
      v.push_back(a);
      a = 0;
    }   
    }
    v.push_back(a);
  max = *max_element(v.begin(),v.end());
  cout << max << endl;
  } 

Measured memory_bytes: 2168
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

template<class T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

template<class T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }


int main() {
    ll r;
    cin>>r;
    cout<<r*r<<endl;

    return 0;
}


Measured memory_bytes: 256
import itertools
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

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

L, R = list(map(int, sys.stdin.readline().split()))

R = min(L + 2020, R)
ans = INF
for i, j in itertools.combinations(range(L, R + 1), r=2):
    ans = min(ans, (i * j) % 2019)

print(ans)


Measured memory_bytes: 40556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    ll n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int prev[200001];
    for(int i=n-1;i>=0;i--){
        prev[a[i]]=i;
    }
    int next[n];
    for(int i=n-1;i>=0;i--){
        next[i]=prev[a[i]];
        prev[a[i]]=i;
    }
    int cnt=1,now=0;
    do{
        if(now>=next[now])cnt++;
        now=(next[now]+1)%n;
    }while(now!=0);
    int r=k%cnt;
    if(r==0){
        cout<<endl;
        return 0;
    }
    cnt=1,now=0;
    while(cnt!=r){
        if(now>=next[now])cnt++;
        now=next[now]+1;
    }
    for(int i=now;i<n;i++){
        if(i<next[i]){
            i=next[i];
        }
        else{
            cout<<a[i]<<" ";
        }
    }
    cout<<endl;
}

Measured memory_bytes: 3840
#include <iostream>

using namespace std;

int main(){
  int a,b,n;
  int x[2]={21,0};
  cin>>n;
  while(n--){
    cin>>a>>b;
    if(x[1]<=b){
      x[0]=(x[1]==b)?(x[0]>a)?a:x[0]:a;x[1]=b;
    }
  }
  cout<<x[0]<<' '<<x[1]<<endl;
  return 0;
}

Measured memory_bytes: 1164
import java.util.*;
import java.math.BigInteger;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long money = 100;
    long goal = sc.nextLong();
    int count = 0;
    while (money < goal) {
      money += money / 100;
      count++;
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 35764
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T> int GetInt(T a){ return a >= 0 ? floor(a) : ceil(a); }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }
const double PI = 3.141592653583;
#define DegreeToRadian(Degree) ((float)Degree * (PI / 180.0f))

vector<string> split(string str, string delim)
{
    vector<string> result;
    int cutAt;
    while( (cutAt = str.find_first_of(delim)) != str.npos )
    {
        if(cutAt > 0)
        {
            result.push_back(str.substr(0, cutAt));
        }
        str = str.substr(cutAt + 1);
    }
    if(str.length() > 0)
    {
        result.push_back(str);
    }
return result;
}

int main()
{
	int x, r, R = 0;
	pair<double, double> point = mp(0, 0);
	string str;
	
	while(cin >> str)
	{
		vector<string> l = split(str, ",");

		x = r = 0;
		rep(i, l[0].size())
		{
			if(l[0][i] != '-')
				x += (l[0][i] - '0') * pow(10, (float)l[0].size() - i -1);
		}
		rep(i, l[1].size())
		{
			if(l[1][i] != '-')
				r += (l[1][i] - '0') * pow(10, (float)l[1].size() - i -1);
		}
		if(l[0][0] == '-')
			x *= -1;
		if(l[1][0] == '-')
			r *= -1;

		if(!(x || r))
			break;

		R = min(R, 360);

		point.first += sin(DegreeToRadian(R)) * x;
		point.second += cos(DegreeToRadian(R)) * x;

		R += r;
	}

	pint res = mp(GetInt(point.first), GetInt(point.second));
	printf("%d\n%d\n", res.first, res.second);
}

Measured memory_bytes: 0
#include <stdio.h>

int main()
{
  int n,h[20],a=1,i,m;
  scanf("%d",&n);
  scanf("%d",&h[0]);
  m = h[0];
  for(i=1;i<n;i++)
    {
      scanf("%d",&h[i]);

      if(m<=h[i])
	{
	  a++;
	  m=h[i];
	}
    }

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


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define N 100005
using namespace std;
int dp[N][3];
int main(){
    int n,i,a,b,c;
    cin>>n;
    for(i=1; i<=n; ++i){
        cin>>a>>b>>c;
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a;
        dp[i][1]=max(dp[i-1][2],dp[i-1][0])+b;
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c;
    }
    cout<<max(max(dp[n][0],dp[n][1]),dp[n][2]);
    return 0;
}


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

using namespace std;

const int N = 3e3+9;
double dp[N][N];

int main() 
{
    int n;
	cin >> n;
	///vector<double> dp(n + 1, 0);
	dp[0][0] = 1;
	for (int i=1; i<=n; i++)
	{
	    double p;
	    cin >> p;
	    for (int j=0; j<=i; j++)
	    {
	        dp[i][j] = dp[i-1][j] * (1 - p);
	        if (j > 0) dp[i][j] += dp[i-1][j-1] * p;
	    }
	}
	double ans = 0.0;
	for (int j=(n+1)/2; j<=n; j++)
	    ans += dp[n][j];
	cout << setprecision(10) << fixed << ans;
	return 0;
}

Measured memory_bytes: 69120
S = input()
for i in range(1 << 4):
    a = ['A' * (i >> j & 1) for j in range(4)]
    b = a[0] + 'KIH' + a[1] + 'B' + a[2] + 'R' + a[3]
    if b == S:
        print('YES')
        break
else:
    print('NO')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int; //任意長整数 
using Real32 = mp::number<mp::cpp_dec_float<32>>;
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
using Rat = boost::rational<Bint>;//有理数*/
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
ll mod = 1000000007;
ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    ll n,time=0;
    cin>>n;
    vector<pair<ll,ll>> v(n);
    for(int i=0;i < n;i++)
    {
        cin>>v.at(i).se>>v.at(i).fi;
    }
    sort(v.begin(),v.end());

    for(int i=0;i < n;i++)
    {
        time+=v.at(i).se;
        if(time>v.at(i).fi){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}



Measured memory_bytes: 3328