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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    LL n,s,w,q;
    cin >> n >> s >> w >> q;
    if(n==0) return 0;
    vector<int> a(n);
    int g=s;
    for(int i=0;i<n;i++){
      a[i]=(g/7)%10;
      if(g%2==0){g=(g/2);}
      else {g=(g/2)^w;}
    }
    // for(int i=0;i<n;i++) cout << a[i];
    // cout << endl;
    LL ans=0;
    LL count=0;
    if(q==2){
      for(int i=0;i<n;i++){
        if(a[i]%2==0) ans+=count+(a[i]?1:0);
        if(a[i]!=0) count++;
      }
      cout << ans << endl;
    }else if(q==5){
      for(int i=0;i<n;i++){
        if(a[i]%5==0) ans+=count+(a[i]?1:0);
        if(a[i]!=0) count++;
      }
      cout << ans << endl;
    }else{
      map<int,LL> amari;
      map<int,LL>::iterator itr;
      vector<LL> ruijo(n);
      ruijo[0]=1;
      for(int i=1;i<n;i++) ruijo[i]=ruijo[i-1]*10%q;
      LL su=0;
      for(int i=0;i<n;i++){
        su=(su+ruijo[i]*a[n-i-1]%q)%q;
        if(a[n-i-1]){
          if(su%q==0) ans++;
          itr=amari.find(su);
          if(itr!=amari.end()){
            ans+=itr->second;
          }
        }
        itr=amari.find(su);
        if(itr==amari.end()){
          amari[su]=1;
        }else{
          itr->second++;
        }
      }
      cout << ans << endl;
    }

  }
  return 0;
}



Measured memory_bytes: 9604
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

int dp[3009][3009];
string s, t, ans = "";

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

    cin >> s >> t;

    for (int i = 1; i <= s.size(); i++)
    {
        for (int j = 1; j <= t.size(); j++)
        {
            dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);

            if (s[i - 1] == t[j - 1])
            {
                dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
            }
        }
    }

    int n = s.size(), m = t.size();
    while (n > 0 && m > 0)
    {
        if (s[n - 1] == t[m - 1])
        {
            ans += t[m - 1];
            n--;
            m--;
        }
        else
        {
            if (dp[n - 1][m] > dp[n][m - 1])
            {
                n--;
            }
            else
            {
                m--;
            }
        }
    }

    reverse(ans.begin(), ans.end());

    cout << ans << "\n";
}

Measured memory_bytes: 35584
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int inf = 1000000000;


int main(void) {

  string s[11] = {"light fly", "fly", "bantam", "feather", "light", "light welter", "welter", "light middle", "middle", "light heavy", "heavy"};

  double w;
  while(cin >> w){

    if( w <= 48.00 ) cout << s[0] << endl;
    else if( w <= 51.00 ) cout << s[1] << endl;
    else if( w <= 54.00 ) cout << s[2] << endl;
    else if( w <= 57.00 ) cout << s[3] << endl;
    else if( w <= 60.00 ) cout << s[4] << endl;
    else if( w <= 64.00 ) cout << s[5] << endl;
    else if( w <= 69.00 ) cout << s[6] << endl;
    else if( w <= 75.00 ) cout << s[7] << endl;
    else if( w <= 81.00 ) cout << s[8] << endl;
    else if( w <= 91.00 ) cout << s[9] << endl;
    else cout << s[10] << endl;
  }

  return 0;
}

// EOF

Measured memory_bytes: 3276
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 
#define PI 3.141592653589793238

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;
typedef gp_hash_table<long int,long int> HashTable;

int main(){
   IOS;
 /*    #ifndef ONLINE_JUDGE
         freopen("in.txt",  "r",  stdin);
         freopen("out.txt", "w", stdout);
     #endif */
   
   long int n,m;
   cin>>n>>m;

   if(n == 1 && m == 0)
    return cout<<"0",0;

   vector<long int> v(n,-1);

   while(m--){
      long int x,y;
      cin>>x>>y;
      x--;

      if(v[x] != -1 && v[x] != y)
        return cout<<"-1",0;

      v[x] = y;
   }

   if(v[0] == -1)
      v[0] = 1;

    if(v[0] == 0 && n != 1)
      return cout<<-1,0;

   for(long int i = 0; i < n; i++)
      if(v[i] != -1)
        cout<<v[i];
      else
        cout<<"0";

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
using int64 = int64_t;
const int MAX = 2e5;
const int MOD = 1e9 + 7;
int64 fac[MAX] = {}; int64 inv[MAX] = {}; int64 finv[MAX] = {};

void make_table(){
    fac[0] = 1; fac[1] = 1;
    finv[0] = 1; finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; ++i) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
int64 com(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
vector<pair<long long,long long>> prime_fact(int64 n){
    vector<pair<long long,long long>> res;
    for (int64 i = 2; i * i <= n; ++i){
        if (n % i != 0) continue;
        int cnt = 0;
        while (n % i == 0){
            n /= i; ++cnt;
        }
        res.emplace_back(i, cnt);
    }
    if (n != 1) res.emplace_back(n, 1);
    return res;
}
int main() {
 ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
 
  make_table();
  int64 n, m; cin >> n >> m;
  vector<pair<long long,long long>> v = prime_fact(m);
  
  int64 ans = 1LL;
  
  for (auto x : v){
    ans = ans * com(x.second + n - 1, x.second) % MOD;
  }
  cout<<(ans % MOD);
 
	return 0;
}

Measured memory_bytes: 4992
n = int(input())
h = [int(i) for i in input().split()]
flag = 1
for i in range(n - 1, 0, -1):
    diff = h[i - 1] - h[i]
    if 2 <= diff:
        flag = 0
        break
    elif diff == 1:
        h[i - 1] -= 1
    else:
        continue

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14252
s = list(input())
n = int(input())

t = []

for i in range(len(s)):
    string = ""
    if i < 4:
        for j in range(0,i+1):
            string = s[i-j] + string
            if string not in t:
                t.append(string)
            else:
                continue
    else:
        for j in range(0,5):
            string = s[i-j] + string
            if string not in t:
                t.append(string)
            else:
                continue
t.sort()
print(t[n-1])

Measured memory_bytes: 40176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
//#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_7 1000003
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

ll coin;

void cal(vector<l_l>v){
    ll n=v.size();
    ll dp[coin+1];memset(dp,0,sizeof(dp));
    rep(i,0,n-1){
        ll a=v[i].first,b=v[i].second;
        rep(j,0,coin){
            if(j-a>=0)Max(dp[j],dp[j-a]+b-a);
        }
        
        /*rep(j,0,coin){
            cout<<dp[j]<<" ";
        }cout<<endl;*/
    }
    
    ll ma=0;
    rep(i,0,coin)Max(ma,dp[i]);
    coin+=ma;
}

int main(){fastio
    
    cin>>coin;
    l_l a[3];
    rep(i,0,2)cin>>a[i].first;
    rep(i,0,2)cin>>a[i].second;
    vector<l_l>v1,v2;
    rep(i,0,2){
        if(a[i].first<a[i].second){
            v1.pb(a[i]);
        }else if(a[i].first>a[i].second){
            swap(a[i].first,a[i].second);
            v2.pb(a[i]);
        }
    }
    cal(v1);
    cal(v2);
    cout<<coin<<endl;
    
    return 0;
}



Measured memory_bytes: 195584
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

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

    int A, B, C;
    cin >> A >> B >> C;
    int res = 0;

    if (A%2 == 1 or B%2 == 1 or C%2 == 1) {
        cout << res << "\n";
        return 0;
    }

    if (A == B and B == C) {
        cout << "-1\n";
        return 0;
    }

    while (true) {
        if (A%2 == 1 or B%2 == 1 or C%2 == 1) {
            cout << res << "\n";
            return 0;
        }

        int tmpA = B/2 + C/2;
        int tmpB = A/2 + C/2;
        int tmpC = A/2 + B/2;
        A = tmpA; B = tmpB; C = tmpC;
        ++res;
    }
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	long long a,b;
	cin >> a >> b;
	long long count[46]={};
	for(int i=0;i<45;i++)
	{
		long long under=1;
		for(int j=0;j<=i;j++)
			under*=2;
		long long bsho=(b+1)/under;
		long long asho=a/under;
		long long bama=(b+1)%under;
		long long aama=a%under;
		bsho=bsho*(under/2);
		asho=asho*(under/2);
		
		long long bnum=bsho;
		bama-=(under/2);
		if(bama>0)bnum+=bama;
		long long anum=asho;
		aama-=(under/2);
		if(aama>0)anum+=aama;

		count[i]=bnum-anum;
	}
	long long ans=0;
	for(int i=0;i<45;i++)
		if(count[i]%2==1)ans+=(1ll<<i);
	cout << ans << endl;
}


Measured memory_bytes: 256
num, legs = map(int, input().split())
BIRD = 2
TURTLE = 4

if legs % 2:
  print("No")
  exit(0)

bird_lst = [BIRD * n for n in range(num+1)]
turtle_lst = [TURTLE * n for n in range(num+1)]
turtle_lst.sort(reverse=True)

legs_lst = [b + t for b, t in zip(bird_lst, turtle_lst)]

if legs in legs_lst:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<double,double> pdd;
typedef pair<long long,long long> pll;
// scanf("%d %d %d %d",&w,&b,&d,&s); %lld
// printf("%d\n" ,points);
// const double PI=acos(-1);

int main(){
    fastIO;
    ll n,rta=1000;
    cin >> n;
    ll values[n];
    for(int i=0;i<n;i++){
        cin >> values[i];
    }
    for(int i=0;i<n-1;i++){
        if(values[i]<values[i+1]){
            rta=((rta/values[i])*values[i+1])+rta%values[i];
        }
    }
    cout << rta << endl;
    return 0;
}


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

int main()
{
    int n, sum = 0;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    sort(a, a + n);
    sum -= a[n - 1];
    cout << (a[n - 1] < sum ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
N=int(input())
W=[]

S=set()
for i in range(N):
    w=input()
    W.append(w)

last=W[0][-1]
S.add(W[0])

for i in range(1,N):
    if W[i][0]==last and not W[i] in S:
        pass
    else:
        print("No")
        exit()
    S.add(W[i])
    last=W[i][-1] #ケツ追加した
print("Yes")

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int div = 2019;
		long L = Integer.parseInt(sc.next());
		long R = Integer.parseInt(sc.next());
		long l = L / div;
		long r = R / div;
		if (l != r) {
			System.out.println(0);
			sc.close();
			return;
		}
		long diff = -1;
		for (long i = L + 1; i <= R; i++) {
			for (long j = L; j < i; j++) {
				long currentDiff = ((i % div) * (j % div)) % div;
				if (diff == -1) {
					diff = currentDiff;
				} else if (diff > currentDiff) {
					diff = currentDiff;
				}
			}
		}
		System.out.println(diff);
		sc.close();
	}
}


Measured memory_bytes: 22992
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define swap(a,b) do{ll w=a;a=b;b=w;}while(0)
#define swapd(a,b) do{double w=a;a=b;b=w}while(0)
#define in(a) scanf("%lld", &(a))
#define ind(a) scanf("%lf", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a));
//def   puts(a) printf("%s\n", a) 文字はこっち
int cmp(const void *a, const void *b);
//your code here!

int main(void){
    ll X, A;
    in(X); in(A);
    puts(X<A?"0":"10");
    return 0;
}

int cmp(const void *a, const void *b){
    ll A=*(ll *)a, B=*(ll *)b;
    if(A==B)return 0;
    else return A>B ? 1:-1;//昇順ソート
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for(int& x: a)
    cin >> x;
  for(int& x: b)
    cin >> x;
  if(a > b)
    swap(a, b);
  int r = 0;
  for(; a < b; r++)
    next_permutation(begin(a), end(a));
  cout << r << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, W;
	cin>>n>>W;
	vector<long long> weight, value;
	for(int i =0;i<n;i++)
	{
		long long a, b;
		cin>>a>>b;
		weight.push_back(a);
		value.push_back(b);
	}
	long long dp[n+1][W+1];
	for(int i = 0;i<=n;i++)
	{
		for(int w = 0; w<= W; w++)
		{
			if(i==0 || w==0)
				dp[i][w]=0;
			else if(weight[i-1] <= w)
				dp[i][w] = max(value[i-1] + dp[i-1][w-weight[i-1]],dp[i-1][w]);
			else
				dp[i][w] = dp[i-1][w];
		}
	}
	cout<<dp[n][W]<<endl;
	return 0;
}

Measured memory_bytes: 79104
#include<iostream>
using namespace std;
int main()
{
    int n,c1,c2,c3,c4;
    cin>>n;
    c1=n%10;n/=10;
    c2=n%10;n/=10;
    c3=n%10;n/=10;
    c4=n%10;n/=10;
    if( ( (c1==c2) && (c2==c3) ) || ( (c2==c3)&&(c3==c4) ))cout<<"Yes";
        else cout<<"No";


}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  
  for(int i = 0; i < n; i++){
    cin >> a.at(i);
  }
  
  bool ans = true;
  
  for(int i = 0; i < n; i++){
    if(a.at(i)%2==0 && a.at(i)%3!=0 && a.at(i)%5!=0){
      ans = false;
      break;
    }
    else{
      continue;
    }
  }
  
  if(ans){
    cout << "APPROVED" << endl;
  }
  else{
    cout << "DENIED" << endl;
  }
}


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

#define ll long long int
#define li long int
#define ld long double
#define W while
#define endl "\n"
#define For(i,s,x) for(i=s;i<x;i++)
#define FOR(i,x) for(i=0;i<x;i++)
#define FoR(i,x) for(i=1;i<=x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define pb push_back
#define pp pop_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007

#define IO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define all(v) v.begin(),v.end()
 
typedef unsigned long long ull;
typedef pair <int, int> pii;
 
const int N = 1e5+5;
const int M = 1e5+5;
const int inf = INT_MAX;
const int MOD = 1e7+9;
int main() {
	IO;
	ld t,d,c=0;
	cin>>t>>d;
	W(t--){
	    //cout<<"test #"<<t<<endl;
	    ld a,b;
	    cin>>a>>b;
	    a=a*a;
	    b=b*b;
	    ld dd=sqrt(a+b);
	    //cout<<dd<<"d "<<endl;
	    if(dd<=d){
	    c++;
	    }
	}
    cout<<c<<endl;
	return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1, (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> v(n, 0);
    REP(i, m){
        int a, b;
        cin >> a >> b;
        v[a-1]++;
        v[b-1]++;
    }
    for(auto i : v){
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;
int main(){
  int q;
  cin >> q;
  int i,j,k;
  string str;
  ll op=0,en=0;
  for(i=0;i<q;i++){
    ll p,n;
    char c;
    cin >> p >> c >> n;
    if(c=='(') op+=n;
    else en+=n;
    if(op==en) cout << "Yes" <<endl;
    else cout << "No" <<endl;   
  }
  return 0;
}

Measured memory_bytes: 1164
import sys
from heapq import heappush, heappop
from collections import deque
from itertools import permutations
input = sys.stdin.readline

def dijkstra(N, start, adj_dict):
    distance = [float('inf')] * N
    distance[start] = 0
    priority_queue = []
    
    for i in range(N):
        heappush(priority_queue, (distance[i], i))
        
    while len(priority_queue) > 0:
        (current_dist, current_node) = heappop(priority_queue)
        if distance[current_node] < current_dist:
            continue
        for next_node, w in adj_dict[current_node]:
            if distance[next_node] >= distance[current_node] + w:
                distance[next_node] = distance[current_node] + w
                heappush(priority_queue, (distance[next_node], next_node))
    
    return distance

N, M, R = map(int, input().split())
r = list(map(int, input().split()))
adj_dict = {i: deque([]) for i in range(N)}

for _ in range(M):
    a_i, b_i, c_i = map(int, input().split())
    adj_dict[a_i-1].append((b_i-1, c_i))
    adj_dict[b_i-1].append((a_i-1, c_i))

distance_map = [dijkstra(N, start, adj_dict) for start in range(N)]
ans = 1000000000

for route in permutations(r):
    ans_cand = 0
    
    for i in range(len(route)-1):
        ans_cand += distance_map[route[i]-1][route[i+1]-1]
    
    ans = min([ans, ans_cand])

print(ans)


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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M = 1e6+6;
bool f[M];
int main()
{
	int k;
	cin>>k;
	int c = 7;
	int z = 1;
	c%=k;
	f[c]=1;
	while(c)
	{
		c=(c*10+7)%k;
		z++;
		if(f[c])
		{
			z=-1;
			break;
		}
		f[c]=1;
	}
	cout<<z<<"\n";
	return 0;
}

Measured memory_bytes: 4528
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	h := make([]int, n)

	for i:=0; i<n; i++ {
		fmt.Scan(&h[i])
	}

	cnt := 0
	i:=0
	for i<n {
		if h[i] == 0 {
			i++
		} else {
			h[i]--
			for j:=i+1; j<n; j++ {
				if h[j] <= 0 {
					break
				}
				h[j]--
			}
			cnt++
		}
	}

	fmt.Println(cnt)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int maxn=2e5+5;
const int INF=1e9+7;
int a[10],b[10];
bool vis[10];
int n;

int main()
{
    
    scanf("%d",&n);
    for (int q=0;q<3;q++)
    scanf("%d",&b[q]);
    for (int q=0;q<n;q++)
    scanf("%d",&a[q]);

    int ans=INF,s;
    int len=(1<<n);
    int t1,t2,t3;
    for (int q=1;q<len;q++)
    {
        for (int w=1;w<len;w++)
        {
            if ((q&w)>0) continue; 
            for (int e=1;e<len;e++)
            {
                if ((e&q)>0 || (e&w)>0) continue;
                t1=t2=t3=s=0;

                for (int r=0;r<n;r++)
                {
                    if ((q>>r)&1) t1+=a[r],s+=10;
                    else if ((w>>r)&1) t2+=a[r],s+=10;
                    else if ((e>>r)&1) t3+=a[r],s+=10;
                }
                s-=30;
                s+=abs(t1-b[0])+abs(t2-b[1])+abs(t3-b[2]);
                ans=min(ans,s);
            }
        }
    }

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

    return 0;
}

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

using namespace std;

vector<string> split(const string &s, char delim) {
  vector<string> elems;
  string item;
  for (char ch: s) {
    if (ch == delim) {
      if (!item.empty()) {
        elems.push_back(item);
      }
      item.clear();
    }
    else {
      item += ch;
    }
  }
  if (!item.empty()) {
    elems.push_back(item);
  }
  return elems;
}

string to_str_with_zero(int i, int w) {
  ostringstream sout;
  sout << std::setfill('0') << std::setw(w) << i;
  string s = sout.str();
  return s;
}

int gcd(int a, int b) {
  if (a == b) {
    return a;
  }
  else if (a > b) {
    return gcd(a - b, b);
  }
  else {
    return gcd(a, b - a);
  }
}

int main() {
  std::cout << std::setprecision(9);
  int n;
  cin >> n;

  vector<int> h(n);
  for(int i=0; i<n; i++) {
    cin >> h.at(i);
  }

  string ans = "Yes";
  int limit = h.at(n - 1);
  for(int i=n-1; i>=0; i--) {
    if (h.at(i) > limit + 1) {
      ans = "No";
      break;
    }
    else if (h.at(i) < limit) {
      limit = h.at(i);
    }
  }
  cout << ans << endl;
}

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

int main(void)
{
    string S, T;
    cin >> S >> T;

    if (S[0] == T[2] && S[1] == T[1] && S[2] == T[0])
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return (0);
}

Measured memory_bytes: 256
def solve(n, a):
    for x in a:
        if x == 0:
            return 0
    ans = 1
    for x in a:
        ans *= x
        if ans > 10**18:
            return -1
    return ans
    
n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))

Measured memory_bytes: 21396
#include <cstdio>

int dp[45];

int fibonacci(int n){
	if (n == 0 || n == 1){
		return 1;
	}
	if(dp[n] != 0){
		return dp[n];
	}
	else{
		return dp[n] = fibonacci(n-1) + fibonacci(n-2);
	}
}

int main(void){
	int n;
	scanf("%d", &n);
	printf("%d\n", fibonacci(n));
	return 0;
}

Measured memory_bytes: 2720
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
char s[105];
int pc,pf;
int main(){
	scanf("%s",s+1);
	bool flag1=false,flag2=false;
	int len=strlen(s+1);
	for(int i=1;i<=len;i++){
		if(s[i]=='C'&&!flag1) flag1=true,pc=i;
		if(s[i]=='F') flag2=true,pf=i;
	}
	if(flag1&&flag2&&pc<pf) printf("Yes\n");
	else printf("No\n");
	return 0;
} 

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

int main() {
  int width;
  int height;
  int row;
  int col;
  string board[50];

  cin >> height >> width;

  for (row = 0; row < height; row++)
  {
    cin >> board[row];
  }

  int dx[8] = {-1,-1,-1,0,0,1,1,1};
  int dy[8] = {-1,0,1,-1,1,-1,0,1};
  
  for(row = 0; row < height; row++)
  {
    for(col = 0; col < width; col++)
    {
      if (board[row][col] == '#')
      {
        continue;
      }
      int num = 0;
      for(int index = 0; index < 8; index++)
      {
        int nx = col + dx[index];
        int ny = row + dy[index];
        
        if (nx < 0 || nx >= width)
        {
          continue;
        }
        if (ny < 0 || ny >= height)
        {
          continue;
        }
        if (board[ny][nx] == '#')
        {
          num++;
        }
      }
      board[row][col] = char(num + '0');
    }
  }

  for (row = 0; row < height; row++)
  {
    cout << board[row] << endl;
  }
  
}


Measured memory_bytes: 256
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>
#include <assert.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF32		INT32_MAX
#define	INF64		INT64_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

bool pair_comp(const pair<ll, ll> & p1, const pair<ll, ll> & p2)
{
	// sort(item.begin(), item.end(), throw_comp)のように使う
	if (p1.first != p2.first) {
		return p1.first < p2.first;
	}
	else {
		return p1.second > p2.second;
	}
}

// main function
int main()
{
	ll N = 0, K =0;
	ll ans = INF32;

	cin >> N >> K;
	vector<ll> h(N);
	Rep(i, N) {
		cin >> h[i];
	}
	sort(h.begin(), h.end());
	for (ll i = 0; i < N - (K - 1); ++i) {
		ll delta = h[i + (K - 1)] - h[i];
		ans = min(ans, delta);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define LIM 1+2+4+8+16+32+64+128
using namespace std;
typedef long long int ll;
typedef struct{
  int per;
  int ko;
  int kyoda;
  int konoko;
}TRE;
int ace(int a,int b){
  int ss=0;
  for(int i=b;i<=a;i++){
    ss+=i;
  }
  return(ss);
}
typedef pair<int,int>P;
int main(){
  int n;
  while(1){
    cin>>n;
    if(n==0){
      break;
    }
    int a[n+1];
    for(int i=0;i<=n;i++){
      cin>>a[i];
    }
    int fl;
    for(int i=0;i<=n;i++){
      fl=0;
      int base;
      if(i<n-1){
	base=a[n]-a[n-1];
      }else{
	base=a[1]-a[0];
      }
      for(int j=0;j<=n-1;j++){
	if(i==j){
	  continue;
	}
	if(j+1==i){
	  if(j==n-1){
	    continue;
	  }
	  if(base!=a[j+2]-a[j]){
	    fl=1;
	    break;
	  }
	}else{
	  if(base!=a[j+1]-a[j]){
	    fl=1;
	    break;
	  }
	}
      }
      if(fl==0){
	cout<<a[i]<<endl;
	break;
      }
    }
  }
  return(0);
}



Measured memory_bytes: 3076
#include <stdio.h>
#include <string.h>

int main (void) {
    int K;
    char S[100];

    scanf ("%d%s", &K, S);

    if (K < strlen(S)) {
        for (int i = 0; i < K; i++) {
            printf("%c", S[i]);
        }
        printf("...\n");
    } else {
        printf("%s\n", S);
    }

    return 0;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i=0; i<n; i++){
			a[i] = sc.nextInt();
		}
		sc.close();
		Arrays.sort(a);
		
		long ans = 1;
		int[] num = new int[n/2];
		int half = 0;
		if(n%2 == 0){
			for(int i=0; i<n; i++){
				if(a[i]%2 == 0){
					System.out.println(0);
					return;
				}
				num[a[i] / 2]++;
			}
		}else{
			for(int i=0; i<n; i++){
				if(a[i]%2 == 1){
					System.out.println(0);
					return;
				}
				if(a[i] == 0){
					half++;
				}else{
					num[a[i] / 2 - 1]++;
				}
			}
			if(half != 1){
				System.out.println(0);
				return;
			}
		}
		for(int i=0; i<n/2; i++){
			if(num[i/2] != 2){
				System.out.println(0);
				return;
			}
			ans *= 2;
			if(ans >= 1000000007){
				ans %= 1000000007;
			}
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 50520
#include <iostream> 
#include <stdlib.h> 
#include <string.h> 
#include <string> 
#include <sstream>
#include <cstring> 
#include<cmath>
using namespace std;
int main()
{
    int x, y,w=0,a;
    cin >> x;
    if (x == 1)
        cout << 1;
    else {
        for (int i = x; i >= 1; i--) {
            int  z = 0;
            y = x;
            while (y > 0) {

                if (y % 2 == 0) {
                    z++;
                }

                y /= 2;
            }
            if (z > w) {
                a = i;
                w = z;
            }x--;
        }
        cout << a;
    }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int s = (a + b + c) / 2;
  cout << sqrt(s * (s - a) * (s - b) * (s - c));
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

signed main()
{
  int X, Y;
  cin >> X >> Y;
  cout << X + Y/2 << endl;

  return 0;
}

Measured memory_bytes: 256
#define y1 askjdkasldjlkasd
#include <bits/stdc++.h>
#undef y1

using namespace std;

#define pb push_back
#define mp make_pair
#define fi(a, b) for(int i=a; i<=b; i++)
#define fj(a, b) for(int j=a; j<=b; j++)
#define fo(a, b) for(int o=a; o<=b; o++)
#define fdi(a, b) for(int i=a; i>=b; i--)
#define fdj(a, b) for(int j=a; j>=b; j--)
#define fdo(a, b) for(int o=a; o>=b; o--)
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while (0)
#endif

double START_TIME;

void exit() {
#ifdef LOCAL	
	cerr << "TIME: " << setprecision(5) << fixed << (clock() - START_TIME) / CLOCKS_PER_SEC << endl;
#endif	
	exit(0);
}

template<typename A, typename B>
ostream& operator<<(ostream& os, pair<A, B> p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, vector<T> v) {
	fi(0, sz(v) - 1) {
		os << v[i] << " ";
	}
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T> t) {
	for (auto z : t) {
		os << z << " ";
	}
	return os;
}

template<typename T1, typename T2>
ostream& operator<<(ostream& os, map<T1, T2> t) {
	cerr << endl;
	for (auto z : t) {
		os << "\t" << z.first << " -> " << z.second << endl;
	}
	return os;
}

#ifdef LOCAL
#define dbg(x) {cerr << __LINE__ << "\t" << #x << ": " << x << endl;}
#define dbg0(x, n) {cerr << __LINE__ << "\t" << #x << ": "; for (int ABC = 0; ABC < n; ABC++) cerr << x[ABC] << ' '; cerr << endl;}
#else
#define dbg(x) while(0){}
#define dbg0(x, n) while(0){}
#endif

#ifdef LOCAL
#define ass(x) if (!(x)) { cerr << __LINE__ << "\tassertion failed: " << #x << endl, abort(); }
#else
#define ass(x) assert(x)
#endif

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

const int MAX = 2e5 + 41;
const int INF = 1e9 + 41;

int n;
int d[MAX][4];
int f1[MAX][4];
int f2[MAX][4];
char s[MAX];

string getsub(int l, int r) {
	string res = string(s + l, r - l + 1);
	return res;	
}

void solve () {	
	fill_n(&d[0][0], MAX * 4, -INF);	
	fi(1, min(3, n)) {
		d[i][i] = 1;
	}
	fi(2, n) {
		fo(1, 3) {
			if (i + o - 1 > n) break;
			string s1 = getsub(i, i + o - 1);
			fj(1, 3) {
				int l = i - j;
				if (l <= 0) break;
				int r = i - 1;				
				string s2 = getsub(l, r);
				if (s1 != s2) {
					if (d[i][o] < 1 + d[l][j]) {
						d[i][o] = 1 + d[l][j];
						f1[i][o] = l;
						f2[i][o] = j;
					}
				}
			}
		}
	}
	int ans = 0;	
	fi(1, min(3, n)) {		
		ans = max(ans, d[n - i + 1][i]);
	}
	printf("%d\n", ans);
	
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	START_TIME = (double)clock();
#endif
	
	scanf("%s", s + 1);
	n = strlen(s + 1);
	solve();

	exit();
	return 0;
}





Measured memory_bytes: 9856
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// -------------------- I/O -------------------- //
///////////////////////////////////////////////////
// https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords
template<typename T> void outputVec(const std::vector<T>& vec, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	for (auto it = vec.begin(); it != vec.end() - 1; ++it) { std::cout << *it << " "; }
	std::cout << *(vec.end() - 1) << "\n";
}
template<typename T> void outputVal(const T& res, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	std::cout << res << "\n";
}
template<typename T> T inputVal() { T a; std::cin >> a; return a; }
template<typename T> std::vector<T> inputVec(int N) {
	std::vector<T> vec(N);
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
	return vec;
}
template<typename T> void inputVec(std::vector<T>& vec) {
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
}

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
template<class T> inline bool chMin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chMax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////
void Main() {
	const ll A = inputVal<int>();
	const ll B = inputVal<int>();

	ll K = -1;
	if ((A + B) % 2 == 0) {
		K = (A + B) / 2;
	}

	if (K > 0) {
		std::cout << K << std::endl;
	}
	else {
		std::cout << "IMPOSSIBLE" << std::endl;
	}

}

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

	double tmp;
	cin >> tmp;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace bla
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            Console.WriteLine(Math.Max(a+b, Math.Max(a-b, a*b)));
        }
    }
}


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

#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0)

int main() {
  FASTIO;
  long long n, k;
  cin >> n >> k;
  if (k == 1)
    cout << "0\n";
  else if (k == 0) {
    cout << n << endl;
  }
  else {
    long long div = n - ((n / k) * k);
    if (div < abs(div - k))
      cout << div << endl;
    else
      cout << abs(div - k) << endl;
  }
  return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int N; cin >> N;
  vector<string> s(N); REP(i, N) cin >> s[i];
  ll ans = 0;
  REP(i, N) {
    REP(k, s[i].size() - 1) {
      if(s[i][k] == 'A' && s[i][k + 1] == 'B') ans++;
    }
  }
  ll BA = 0; ll A = 0; ll B = 0;
  REP(i, N) {
    if(s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A') BA++;
    else if(s[i][0] == 'B') B++;
    else if(s[i][s[i].size() - 1] == 'A') A++;
  }
  if(BA > 0) {
    ans += (BA - 1);
    if(A > 0 && B > 0) ans += 2;
    else if(A + B > 0) ans++;
    ans += min(max(A - 1, (ll)0), max(B - 1, (ll)0));
  } else if(BA == 0) ans += min(A, B);
  cout << ans << endl;
}

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

int main(){
    int h, w; cin >> h >> w;
    char ans[h][w];
    string s[50];
    rep(i,h){
        cin >> s[i];
        rep(j,w) ans[i][j] = s[i][j];
    }

    const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
    const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
    rep(i, h){
        rep(j, w){
            if(ans[i][j] == '#') continue;
            int cnt=0;
            for (int d = 0; d < 8; ++ d) {
                const int ni = i + dy[d];
                const int nj = j + dx[d];

                if (ni < 0 or h <= ni) continue;
                if (nj < 0 or w <= nj) continue;
                if (s[ni][nj] == '#') cnt++;
            }  
            ans [i][j] = (char)(cnt + '0'); 
            
        }
    }
    rep(i,h){
        rep(j, w){
            printf("%c", ans[i][j]);
        }
        printf("\n");
    }
    return 0;

}

Measured memory_bytes: 3616
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = "";

        while ((line = br.readLine()) != null && !line.isEmpty()) {
            StringTokenizer st = new StringTokenizer(line);
            int a, b, c, d, e, f;
            double x, y;
            a = Integer.parseInt(st.nextToken());
            b = Integer.parseInt(st.nextToken());
            c = Integer.parseInt(st.nextToken());
            d = Integer.parseInt(st.nextToken());
            e = Integer.parseInt(st.nextToken());
            f = Integer.parseInt(st.nextToken());
            x = (double) (c * e - b * f) / (a * e - b * d);
            y = (double) (c * d - a * f) / (b * d - a * e);
            if (x == -0.0)
                x = 0.0;
            if (y == -0.0)
                y = 0.0;
            System.out.printf("%4.3f %4.3f\n", x, y);
        }
    }
}

Measured memory_bytes: 17156
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll a,b,c;
    while(cin>>a>>b>>c){
        if(c-a-b<=0){
            cout<<"No"<<endl;
            return 0;
        }
        if(4*a*b<((c-a-b)*(c-a-b))){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
//#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define printP(x) "(" << (x).first << ", " << (x).second << ")"
#define mod 1000000007
using namespace std;
typedef pair<int, int> P;

llint n;
llint a[200005], b[200005];
queue<llint> Q;

llint get(llint p)
{
	if(b[p] <= a[p] && b[p] <= b[(p-1+n)%n]+b[(p+1)%n]) return 0;
	llint s = b[(p-1+n)%n]+b[(p+1)%n], m = max(b[(p-1+n)%n], b[(p+1)%n]);
	return min((b[p]-a[p])/s, (b[p]-m+s-1)/s);
}

int main(void)
{
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n; i++) cin >> b[i];
	
	for(int i = 0; i < n; i++){
		if(get(i) > 0) Q.push(i);
	}
	
	llint ans = 0;
	while(Q.size()){
		llint p = Q.front(); Q.pop();
		llint x = get(p), s = b[(p-1+n)%n]+b[(p+1)%n];
		ans += x, b[p] -= x * s;
		if(get((p+1)%n) > 0) Q.push((p+1)%n);
		if(get((p+n-1)%n) > 0) Q.push((p+n-1)%n);
	}
	for(int i = 0; i < n; i++){
		if(a[i] != b[i]){
			cout << -1 << endl;
			return 0;
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 4224
#include<stdio.h>
int main(void)
{
	int n,a[100],i,j,x,c,sum,sum2;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	//for(i=0;i<n;i++)	printf("%d ",a[i]);
	//printf("\n");
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			if(a[i]<a[j]){
				x=a[i];
				a[i]=a[j];
				a[j]=x;
			}
		}
	}
	//for(i=0;i<n;i++)	printf("%d ",a[i]);
	//printf("\n");
	sum=sum2=0;
	for(i=0;i<n;i++){
		if(i%2==0){
			sum+=a[i];
		}
		else{
			sum2+=a[i];
		}
	}
	c=sum-sum2;
	printf("%d\n",c);
	return 0;
}


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

int main(){
  int x; cin >>x;
  for(int i=-54; i<120; i++)
  {
    for(int j=-54; j<120; j++)
    if(pow(i,5)-pow(j,5)==x){cout <<i<<" "<<j; return 0;}
  }
}

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

using namespace std;

int n;
vector< pair< pair<string, int>, int> > table;

int main(){
	cin >> n;
	table.resize(n);
	for(int i = 0; i < n; ++i){
		cin >> table[i].first.first >> table[i].first.second;
		table[i].first.second *= -1;
		table[i].second = i + 1;
	}
	sort(table.begin(), table.end());
	
	for(int i = 0; i < n; ++i){
		cout << table[i].second << endl;
	}
}

Measured memory_bytes: 256
import bisect

n = int(input())
l_list = list(map(int,input().split()))

l_list.sort()

count=0
for i in range(n-2):
    for j in range(i+1,n-1):
        a=l_list[i]
        b=l_list[j]
        
        count+=(bisect.bisect_left(l_list,a+b)-j-1)

print(count)

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n;
  cin>>n;
  string s;
  cin>>s;
  ll k;
  cin>>k;
  
  REP(i,n){
    if(s[i]!=s[k-1])
      cout<<"*";
    else
      cout<<s[i];
  }
  cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define INF 2e9
#define MOD 1e9+7
#define ALL(v) v.begin(), v.end()

int ni() {
    int i;
    cin >> i;
    return i;
}

int main() {
    int N = ni();
    int M = ni();

    cout << ((1900*M + 100*(N-M)) * 1<<M) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	int small,middle,big,x;
	Scanner scan=new Scanner(System.in);
	small=scan.nextInt();
	middle=scan.nextInt();
	big=scan.nextInt();
	if(small>middle)
	    {
		x=middle;
		middle=small;
		small=x;
	    }
	if(small>big)
	    {
		x=big;
		big=small;
		small=x;
	    }
	if(middle>big)
	    {
		x=big;
		big=middle;
		middle=x;
	    }
	System.out.println(small+" "+middle+" "+big);
    }
}

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

int main()
{
    int n;
    ll d[100001];
    ll sum_d[100001];
    ll ans=1;
    cin>>n;
    for (int i = 0; i < n; i++)
    {
        cin>>d[i];
        sum_d[i]=0;
    }

    for (int i = 0; i < n; i++)
    {
        sum_d[d[i]]++;
    }

    if(d[0]!=0 || sum_d[0]!=1){
        cout<<0;
        return 0;
    }

    // for (int i = 0; i < n; i++)
    // {
    //     cout<<i<<" "<<sum_d[i]<<endl;
    // }

    ll sum=1;

    for (int i = 1; i < n; i++)
    {
        if(sum_d[i]>0){
            ll tmp=1;
            for(int j=0;j<sum_d[i];j++){
                tmp=(tmp*sum_d[i-1])%998244353;
            }
            ans = (ans*tmp)%998244353;

            //ans = (ans * (ll)pow(sum_d[i-1],sum_d[i]))%998244353;
            sum+=sum_d[i];
        }else{
            break;
        }
    }
    //cout<<"sum"<<sum<<endl;
    if(sum==n){
        cout<<ans;
    }else{
        cout<<0;
    }
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <queue>
#include <time.h>

using namespace std;

#define INT_MAX 2147483647
typedef long long ll;

ll gcd(ll m, ll n);		//最大公倍数
ll lcm(ll m, ll n);		//最小公倍数

int main(void) {

	int ans = 0;

	int n;
	cin >> n;
	if (n >= 105 && n < 135) ans = 1;
	else if (n >= 135 && n < 165) ans = 2;
	else if (n >= 165 && n < 189) ans = 3;
	else if (n >= 189 && n < 195) ans = 4;
	else if (n >= 195) ans = 5;


	cout << ans << endl;

	return 0;

}

// 2番目から3要素だけ抜き出した部分文字列を取得する
//std::string result = s.substr(2, 3);  

#if 1
//最大公倍数
ll gcd(ll m, ll n)
{
	ll temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}
#endif

Measured memory_bytes: 256