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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

int main() {
	int n, x, y;
	cin >> n >> x >> y;
	x--;
	y--;

	int a[n][n];
	fill(a[0], a[n], 0);

	// 0
	REP(i,n) {
		if(i < y) {
			a[0][i] = min(i, (x+y-i)+1);
		} else {
			a[0][i] = x+(i-y)+1;
		}
	}
	// 1 <= i < x+1
	FOR(i,1,x+1) {
		FOR(j,i,n){
			a[i][j] = a[i-1][j]-1;
		}
	}
	// x+1 <= i < y
	FOR(i,x+1,y) {
		FOR(j,i,n) {
			a[i][j] = min(j-i, (i-x)+abs(y-j)+1);
		}
	}
	// y <= i < n
	FOR(i,y,n) {
		FOR(j,i,n) {
			a[i][j] = j-i;
		}
	}


	int cnt[n];
	fill(cnt, cnt+n, 0);

	REP(i,n-1) {
		FOR(j,i+1,n) {
			cnt[a[i][j]]++;
		}	
	}
	REP(i,n-1) {
		cout << cnt[i+1] << endl;
	}
	// REP(i, n) {
	// 	REP(j,n) {
	// 		printf("%2d ", a[i][j]);
	// 	}
	// 	cout << endl;
	// }

	return 0;
}




Measured memory_bytes: 15872
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>

#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
using namespace std;


int main(int argc, char *argv[]) {
    int n;
    cin >> n;
    for (int i = 1; i <= 9; i++) {
        if (n % i == 0 && n / i <= 9) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}




Measured memory_bytes: 384
import math

n, d = [int(elem) for elem in input().split()]
xs = []
for i in range(0, n):
    x = [int(elem) for elem in input().split()]
    xs.append(x)

def kyori(ys, zs):
    result = 0
    for y, z in zip(ys, zs):
        result += (y - z) ** 2
    return math.sqrt(result)
    
cnt = 0
for i in range(0, n):
    for j in range(i+1, n):
        res = kyori(xs[i], xs[j])
        if res == int(res):
            cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>

int minimumCountSort(int n, int* a)
{
    int sum_a = 0;
    int min = 100000;
    int B[1000], T[10001];
    bool V[1000];
    int ans = 0;
    int min_a = 10000;

    //?????????
    for (int i = 0; i < n; i++) {
	B[i] = a[i];
	V[i] = false;
	if (min_a > a[i]) {
	    min_a = a[i];
	}
    }
    std::sort(B, B + n);
    for (int i = 0; i < n; i++) {
	T[B[i]] = i;
    }
    int minSolve = sum_a + (n - 2) * min;
    int* b = (int*)malloc(n * sizeof(int));
    for (int i = 0; i < n; i++) {
	if (V[i]) {
	    continue;
	}
	int cur = i;
	int sum = 0;
	int min = 10000;
	int an = 0;
	while (1) {
	    V[cur] = true;
	    an++;
	    int v = a[cur];
	    min = std::min(min, v);
	    sum += a[cur];
	    cur = T[v];
	    if (V[cur]) {
		break;
	    }
	}
	ans += std::min(sum + (an - 2) * min, min + sum + (an + 1) * min_a);
    }
    return ans;
}

int main()
{
    int n = 0;
    std::cin >> n;
    int* a = (int*)malloc(n * sizeof(int));
    for (int i = 0; i < n; i++) {
	std::cin >> a[i];
    }
    int answer = minimumCountSort(n, a);
    std::cout << answer << std::endl;
}

Measured memory_bytes: 1228
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cstdlib>
#include <algorithm>
using i64 = long long;
using namespace std;

pair<i64, i64> solve(i64 b) {
  for (i64 n = 100000; n >= 1; --n) {
    i64 shou = b / n;
    i64 amari = b % n;
    if (n % 2 == 1) {
      if (amari == 0) {
        i64 min = shou - n / 2;
        if (min >= 1) return make_pair(min, n);
      }
    } else {
      if (amari == n / 2) {
        i64 min = shou - (n / 2 - 1);
        if (min >= 1) return make_pair(min, n);
      }
    }
  }
  cerr << "Error!!!!!" << endl;
  exit(-1);
}

int main() {
  i64 b;
  while (cin >> b && b > 0) {
    auto res = solve(b);
    cout << res.first << " " << res.second << endl;;
  }
  return 0;
}



Measured memory_bytes: 3064
n = int(input())
h = list(map(int, input().split()))
#h, w = list(map(int, input().split()))
count = 0
ans = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        count += 1

    else:
        if count > ans:
            ans = count
        count = 0
    #print(count)

if count > ans:
    ans = count

print(ans)
   

Measured memory_bytes: 15020
/*
 _____ _             _              _           _ 
|_   _| |__   ___   / \   _ __  ___| |__  _   _| |
  | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  | | | | | |  __// ___ \| | | \__ \ | | | |_| | |
  |_| |_| |_|\___/_/   \_\_| |_|___/_| |_|\__,_|_|                                                

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll,ll>
#define msi         map<string,ll>
#define mis         map<ll, string>
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x) 	for(auto& a : x)
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound

/*	For Debugging	*/
#define DEBUG 		cerr<<"/n>>>I'm Here<<</n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace __gnu_pbds;
using namespace std;
#define PI 3.141592653589793
#define N  85
#define M 	(2*80*80)
/************************************/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
/************************************/

bool dp[N][N][M];
ll a[N][N],b[N][N];
ll n,m;

void solve()
{
	cin>>n>>m;
	rep(i,0,n)
	{
		rep(j,0,m)
		{
			cin>>a[i][j];
		}
	}
	rep(i,0,n)
	{
		rep(j,0,m)
		{
			cin>>b[i][j];
		}
	}
	dp[0][0][abs(a[0][0]-b[0][0])]=1;
	// ll M=0;
	// rep(i,0,n)
	// {
	// 	rep(j,0,m)
	// 	{
	// 		M=max(abs(a[i][j]-b[i][j]),M);
	// 	}
	// }
	rep(i,0,n)
	{
		rep(j,0,m)
		{
			rep(k,0,M)
			{
				if(dp[i][j][k])
				{
					ll p1,p2;
					p1=k+abs(a[i+1][j]-b[i+1][j]);
					p2=abs(k-abs(a[i+1][j]-b[i+1][j]));
					if(p1<6405)
					{
						dp[i+1][j][p1]=1;
					}
					if(p2<6405)
					{
						dp[i+1][j][p2]=1;
					}
					p1=k+abs(a[i][j+1]-b[i][j+1]);
					p2=abs(k-abs(a[i][j+1]-b[i][j+1]));
					if(p1<6405)
					{
						dp[i][j+1][p1]=1;
					}
					if(p2<6405)
					{
						dp[i][j+1][p2]=1;
					}
				}
			}
		}
	}
	rep(i,0,M)
	{
		if(dp[n-1][m-1][i])
		{
			cout<<i<<endl;
			return;
		}
	}
	return;
}
int main()
{
	FAST
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	TIME
	return 0;
}

Measured memory_bytes: 87424
n,m,k=map(int,input().split())
mod=998244353
fact=[1]
fact_inv=[1]
for i in range(n+1):#<< Nの最大値
    new_fact=fact[-1]*(i+1)%mod
    fact.append(new_fact)
    fact_inv.append(pow(new_fact,mod-2,mod))

def mod_comb(n,k,mod):
    return fact[n]*fact_inv[k]%mod*fact_inv[n-k]%mod

ans=0
for i in range(k+1):
    ans+=m*pow(m-1,n-1-i,mod)*mod_comb(n-1,i,mod)%mod
ans%=mod
print(ans)


Measured memory_bytes: 103676
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main() {
  int n,p;
  string s;
  cin >> n;
  vector<pair<pair<string,int>,int>> pa(n);
  for(int i=0; i<n; i++) {
    cin >> s >> p;
    pa[i]=make_pair(make_pair(s,100-p),i+1);
  }
  sort(pa.begin(),pa.end());
  for(int i=0; i<n; i++) {
    cout << pa[i].second << endl;
  }
}

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

int main()
{
  int N,x;long long ans=0;scanf("%d %d",&N,&x);
  int a[N];
  for(int i=0;i<N;i++)scanf("%d",&a[i]);
  if(a[0]>x){ans+=(a[0]-x);a[0]=x;}
  for(int i=1;i<N;i++)if(a[i-1]+a[i]>x){ans+=(a[i-1]+a[i]-x);a[i]-=(a[i-1]+a[i]-x);}
  printf("%lld\n",ans);
}

Measured memory_bytes: 4164
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define fo(i,n) for(i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define MAXN 1000002
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod=1e9+7;
void solve()
{
  string str1,str2;
  cin>>str1>>str2;
string s="";
  for(int i=0;i<str2.length()-1;i++)
  s+=str2[i];
  if(s==str1)
  cout<<"Yes";
  else
  cout<<"No";
}

int main()
{
  fastio
  solve();
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define lli long long int
#define ulli unsigned long long int
#pragma GCC target ("sse4.2")
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define time cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";

int main()
{


    lli n,k;
    cin>>n>>k;
    cout<<int(log(n)/log(k))+1;

    
    return 0;


}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
typedef long long ll;
#define out(i) cout<<(i)<<endl

int main() {
  ll N,Max,Min;
  cin>>N;
  vector<ll> T(N);
  rep0(i,N){cin>>T[i];}
  Min=T[0]; Max=-1000000000;
  for(ll i=1;i<=N-1;i++){
      Max=max(Max,T[i]-Min);
      Min=min(Min,T[i]);
  }
  cout<<Max<<endl;
}



Measured memory_bytes: 4416
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define speed                     \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define ll long long
#define pb push_back
#define mem1(a) memset(a, -1, sizeof(a))
#define mem0(a) memset(a, 0, sizeof(a))
#define endl "\n"
#define mod 1000000007
#define mod1 998244353
#define ff first
#define ss second
#define MAX 500005
#define N 10004
#define INF 1000000009
#define all(v) v.begin(), v.end()
#define sbit(a) __builtin_popcount(a)
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef pair<ll, ll> pll;
typedef pair<pll, ll> ppl;
typedef map<ll, ll> mpll;
typedef map<vector<ll>, ll> mpvl;
ll power(ll x, ll y, ll p)
{
    ll res = 1;

    x = x % p;

    if (x == 0)
        return 0;
    while (y > 0)
    {

        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }

    return res;
}
void solve()
{

   ll n;
   cin>>n;
   ll ans=0;
   for(ll i=1;i<=n-1;i++)
   {
       ll j=1;
       while(i*j<n)//time complexity=n*(1/1+1/2+1/3+.....)=n*log(logn)
       {
          ans++;
          j++;
       }
   }
   cout<<ans<<endl;
}
int main()
{
    speed;
    ll kk;
    kk = 1;
    //cin >> kk;
    while (kk--)
    {

        solve();
    }

    return 0;
}

Measured memory_bytes: 3584
N = int(input())
s = [int(x) for x in input().split()]
def count(P):
    a = 0
    for i in range(N):
        b = (s[i]-P)**2
        a = a + b
    return a

c = count(1)
for i in range(100):
    if count(i+1) <= c:
        c = count(i+1)
print(c)

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

using namespace std;




int main(){

	int k, x; cin >> k >> x;

	for(int i = max((int)-1e6, x - k + 1); i <= min((int)1e6, x + k - 1); i++){
		cout << i << " ";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

typedef struct {
  double x, y;
} Point;


void plot(int n, Point p1, Point p2){
  Point s, t, u;
  double a = 60.0*(acos(-1)/180.0);
  if ( n == 0 ) return;
  s.x = (2.0 * p1.x + 1.0 * p2.x)/3.0;
  s.y = (2.0 * p1.y + 1.0 * p2.y)/3.0;
  t.x = (1.0 * p1.x + 2.0 * p2.x)/3.0;
  t.y = (1.0 * p1.y + 2.0 * p2.y)/3.0;
  u.x = (t.x - s.x) * cos(a) - (t.y - s.y ) * sin(a) + s.x;
  u.y = (t.x - s.x) * sin(a) + (t.y - s.y ) * cos(a) + s.y;

  plot(n-1, p1, s);
  print(s);
  plot(n-1, s, u);
  print(u);
  plot(n-1, u, t);
  print(t);
  plot(n-1, t, p2);
}

void print(Point p){
  printf("%.8f %.8f\n", p.x, p.y);
}


main(){
  Point p1, p2;
  int n;
  scanf("%d", &n);

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;
  print(p1);
  plot(n, p1, p2);
  print(p2);

  return 0;
}





Measured memory_bytes: 2088
// This amazing code is by Eric Sunli Chen.
#include<bits/stdc++.h>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

const int maxn=300111;

int n,l,x[maxn],t[maxn];
bool go_l[maxn],go_r[maxn];

int main()
{
	get2(n,l);
	for(int i=1;i<=n;i++)get1(x[i]);
	for(int i=1;i<=n;i++)get1(t[i]);
	
	LL ans=0;
	l*=2;
	for(int i=1;i<=n;i++)
	{
		if(t[i]%l==0)ans+=t[i];
		else
		{
			ans+=t[i]/l*l+l;t[i]%=l;
			if(t[i]<=x[i]*2)go_l[i]=1;
			if(t[i]<=(l-x[i]*2))go_r[i]=1;
		}
	}
	int cx=0,cy=0;
	for(int i=1;i<n;i++)
	{
		if(cx&&go_r[i])
		{
			if(go_l[i])cy++;
			cx--;ans-=l;
		}
		else if(go_l[i])cx++;
		else if(!go_l[i]&&go_r[i]&&cy)
		{
			cy--;
			cx++;
		}
	}
	if(!go_r[n])ans+=l;
	printendl(ans);
	return 0;
}

Measured memory_bytes: 3200
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
 
using namespace __gnu_pbds;
using namespace std;

#define double      	long double
#define int         	long long
#define pb          	push_back
#define pii         	pair<int,int>
#define vi          	vector<int>
#define vii         	vector<pii>
#define mi          	map<int,int>
#define mii         	map<pii,int>
#define all(a)      	(a).begin(),(a).end()
#define sz(x)       	(int)x.size()
#define endl        	"\n"
#define repp(i,a,b) 	for(int i=a;i<b;i++)
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define brep(i,a,b)     for(int i=a;i>=b;i--)
#define deb1(x)      	cout << #x << "=" << x << endl
#define deb2(x, y)  	cout << #x << "=" << x << "," << #y << "=" << y << endl
#define deb3(x, y, z)  	cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define trace(v) 		for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
#define tracearr(a,l,r) for(int iii=l;iii<=r;iii++)cout << a[iii] << " ";cout << endl;
#define PI          	3.1415926535897932384626
#define F 				first
#define S 				second
#define clr(x) 			memset(x, 0, sizeof(x))
#define IOS         	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// *s.find_by_order(1) - gives the 2nd samllest element in set
// s.order_of_key(x)   - gives the number of elements in the set which are strictly smaller than x


const int N=1e5 + 5;
const int MOD=1e9 + 7;

int32_t main()
{
	IOS;
	int T=1;
	// int numOfSetBits = __builtin_popcountll(n);
	std::cout << std::fixed << std::setprecision(12);
	while(T--)
	{
		int x,y;
		cin >> x >> y;
		int minn = x*2;
		int maxx = x*4;
		if(y>=minn && y<=maxx && y%2==0)
			cout << "Yes";
		else
			cout << "No";
	}
}



Measured memory_bytes: 3660
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0

c500 = X // 500

if c500 > A:
    c500 = A

for i in range(c500 + 1):
    c100 = (X - i*500) // 100
    if c100 > B:
        c100 = B
    for j in range(c100 + 1):
        c50 = (X - i*500 - j*100) // 50
        if c50 <= C:
           ans += 1

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <typeinfo>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
int main(void){
    string s;
    cin >> s;
    int n = s.length();
    int cg = 0;
    int cp = 0;
    bool pmod = false;
    int score = 0;
    for(int i=0; i<n; i++){
        if(pmod){
            if(s[i]=='g'){
                score += 1;
            }
        }else{
            if(s[i]=='g'){
                cg += 1;
            }else{
                if(cg>cp){
                    cp += 1;
                }else{
                    cg += 1;
                    score -= 1;
                }
            }
        }
        if(n-(cg+cp)<=(cg-cp)){
            pmod=true;
        }
    }
    cout << score << endl;
}

Measured memory_bytes: 512
class UnionFind:

    def __init__(self, n):
        # parent[x] < 0 means x is root and abs(parent[x]) == size[x]
        self.parent, self.depth = [-1] * n, [0] * n

    def find(self, x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def isSame(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        if self.isSame(x, y):
            return
        x, y = self.find(x), self.find(y)

        if self.depth[x] > self.depth[y]:
            self.parent[x] += self.parent[y]
            self.parent[y] = x
        else:
            self.parent[y] += self.parent[x]
            self.parent[x] = y
            if self.depth[x] == self.depth[y]:
                self.depth[y] += 1

    def size(self, x):
        return - self.parent[self.find(x)]

    def numTree(self):
        return sum([1 for p in self.parent if p < 0])


N, M = map(int, input().split())
U = UnionFind(N)

for i in range(M):
    X, Y, Z = map(int, input().split())
    U.unite(X - 1, Y - 1)

print(U.numTree())


Measured memory_bytes: 7748
#include<bits/stdc++.h>
using namespace std;
const int X=2e5+10;
int a[X];
int main(){
	ios::sync_with_stdio(false);
	int n;cin>>n;
	long long ans=0;
	a[0]=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]<a[i-1]){
			ans+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
		
	}
	cout<<ans<<endl;
	return 0;
}

/*always remember:
1.list all the things you know and find the breakthrough
*/


Measured memory_bytes: 4428
#include <iostream>

using namespace std;

int main(void)
{
  long long a, b, c;
  
  cin >> a >> b >> c;
  
  long long comp = (c - a - b) * (c - a - b);
  
  if(a * b * 4 < comp && c - a - b > 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}

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

/* define const */
const int Max = 100000;
/* finish defineing const */

int n;
int a[Max + 10] = {};
int num[Max + 10];

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        num[a[i]]++;
    }
    // input
    /*
    for (int k = 0; k < 10; k++)
    {
        cout << num[k] << " ";
    }
    cout << endl;
*/
    int i = 0;
    int j = Max;
    int cnt = n;

    // 2種類の数が重複している
    while (1)
    {
        while (num[i] <= 1)
        {
            i++;
            if (i >= j)
            {
                goto L;
            }
        }
        while (num[j] <= 1)
        {
            j--;
            if (j <= i)
            {
                goto L;
            }
        }
        num[i]--;
        num[j]--;
        cnt -= 2;
    }
L:
    i = 0;
    // 1種類の数が重複
    while (i <= Max && num[i] <= 1)
    {
        i++;
    }
    while (i <= Max && num[i] >= 2)
    {
        num[i] -= 2;
        cnt -= 2;
    }

    cout << cnt << endl;
}


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

typedef long long ll;

vector<int> g[200100];

main()
{
    int n,m,i,t,a,b;
    scanf("%d %d",&n,&m);
    for(i=0;i<m;i++)
    {
        scanf("%d %d",&a,&b);
        g[a].push_back(b);
        g[b].push_back(a);
    }
    queue<int> q;
    q.push(1);
    int vis[200100],x;
    memset(vis,0,sizeof vis);
    vis[1]=1;
    while(!q.empty())
    {
        x=q.front();
        q.pop();
        if(vis[x]>=3) continue;
        for(i=0;i<g[x].size();i++)
        {
            if(!vis[g[x][i]])
            {
                vis[g[x][i]]=vis[x]+1;
                q.push(g[x][i]);
            }
        }
    }
   // cout<<vis[n]<<endl;
    if(vis[n]==3)
        printf("POSSIBLE\n");
    else
        printf("IMPOSSIBLE\n");
    return 0;
}


Measured memory_bytes: 13168
from heapq import heappush, heappop
from collections import defaultdict

N, X, D = map(int, input().split())

if D == 0 :
  if X == 0 :
    print(1)
  else :
    print(N + 1)

else :
  s = X * N + D * N * (N - 1) // 2

  h = defaultdict(lambda: [])
  for i in range(N + 1) :
    a = X * i + D * i * (i - 1) // 2
    b = X * i + D * i * (2 * N - i - 1) // 2
    
    m = 2 * a - s
    M = 2 * b - s
    
    if M < m :
      m, M = M, m
      
    heappush(h[m % (abs(D) * 2)], (m, M))

  D = abs(D)

  ret = 0
  for heap in h.values() :
    u, v = heappop(heap)
    while heap :
      if heap[0][0] <= v :
        v = max(v, heap[0][1])
        heappop(heap)
      else :
        ret += (v - u) // (2 * D) + 1
        u, v = heappop(heap)
        
    ret += (v - u) // (2 * D) + 1

  print(ret)

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

int main(void)
{
    long long N, M;
    long long sum = 0;
    cin >> N;
    M = N;
    
    while (1) {
        sum += N % 10;
        if (N / 10 == 0) break;
        else N /= 10;
    }
    
    cout << (M % sum == 0? "Yes" : "No") << endl;
}


Measured memory_bytes: 3620
n = int(input())
h = [int(i) for i in input().split()]
i = n - 1
while i >= 1:
    if h[i] >= h[i-1]:
        i -= 1
    elif h[i] == h[i-1] - 1:
        h[i-1] -= 1
        i -= 1
    else:
        print('No')
        break
else:
    print('Yes')

Measured memory_bytes: 14224
#include<stdio.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  Q[tail]=x;
  if(tail+1==LEN)tail=0;
  else tail++;
}

P dequeue(){
  P x;
  x=Q[head];
  if(head+1==LEN)head=0;
  else head++;
  return x;
}


int main(){
  int elaps = 0, c=0,a;
  int i, q;
  P u;
  int cont=0;
  scanf("%d %d", &n, &q);
  head=1;tail=n+1;
  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  
while(head!=tail){
  u=dequeue();
  if(u.t>q){
    u.t=u.t-q;
    elaps+=q;
    enqueue(u);
  }
  else {
    elaps+=u.t;
    printf("%s %d\n",u.name,elaps);
  }
 }
  return 0;
}



Measured memory_bytes: 11892
package main

import (
	"fmt"
	"math"
)

func main() {
	n, ww := SingleInt(), SingleInt()
	vals, weis := make([]int, 0, n), make([]int, 0, n)

	for i := 0; i < n; i++ {
		vals = append(vals, SingleInt())
		weis = append(weis, SingleInt())
	}

	// dp[i+1][w] := i 番目までの品物の中から重さが w を超えないように選んだときの、価値の総和の最大値

	// index + 1 に対して、

	dp := make([][]int, n+1)
	dp[0] = make([]int, ww+1)
	for i := 0; i < n; i++ {
		dp[i+1] = make([]int, ww+1)
		for w := 0; w <= ww; w++ {
			if w >= weis[i] {
				dp[i+1][w] = Max(dp[i][w-weis[i]]+vals[i], dp[i][w])
			} else {
				dp[i+1][w] = dp[i][w]
			}
		}
		// fmt.Printf("%#v\n", dp[i+1])
	}

	fmt.Printf("%#v\n", dp[n][ww])

	// a := int64(math.Pow(3, float64(n)))
	// fmt.Printf("%#v\n", (a-(3*dp1[n-1])+(3*dp2[n-1]))%mod)
}

func SingleInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func Max(nums ...int) int {
	if len(nums) == 0 {
		panic("function max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func Min64(nums ...int64) int64 {
	if len(nums) == 0 {
		panic("function min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int64(math.Min(float64(res), float64(nums[i])))
	}
	return res
}



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

int main(){
    int n;
    cin >> n;
    vector<int> v;

    int ai = 0;
    for(int i=0;i<n;++i){
        int a;
        cin >> a;
        v.push_back(a);
        ai = max(ai, a);
    }

    sort(v.begin(), v.end());
    int aj = v[0], mid1 = ai/2, mid2 = (ai+1)/2;
    for(int i=1;i<n;++i){
        if(v[i] == ai)continue;
        if(abs(v[i]-mid1) < abs(aj-mid1) || abs(v[i]-mid2) < abs(aj-mid2))aj = v[i];
    }

    cout << ai << " " << aj << endl;

    return 0;
}


Measured memory_bytes: 892
import sys
from collections import Counter
 
A = sys.stdin.readline().strip()
la = len(A)
 
ans = la * (la - 1) // 2 + 1
counter = Counter(A)
for key, count in counter.items():
    if count == 1:
        continue
    ans -= count * (count - 1) // 2
 
print(ans)

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


int main() {
    string S; cin >> S;
    if ("Sunny" == S) {
        cout << "Cloudy" << endl; 
    } else if ("Cloudy" == S) {
        cout << "Rainy" << endl;
    } else {
        cout << "Sunny" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    k, x = map(int, input().split())
    ans = list()

    for i in range(max(-10 ** 6, x - k + 1), min(10 ** 6 + 1, k + x)):
        ans.append(i)

    print(' '.join(map(str, ans)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define MOD 1000000007

using namespace std;
typedef pair<int, int> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

class modint {
    static llong modulo(llong left) {
        llong res = left % MOD;
        return res < 0 ? res + abs(MOD) : res;
    }

    llong val;
public:

    modint() { }
    modint(llong base) { val = modulo(base); }

    //x^nの剰余を求める: O(logn)
    static modint pow(modint x, llong n) {
        modint res = modint(1);
        while(n != 0) {
            if(n % 2 == 1)
                res *= x;
            x *= x;
            n = n >> 1;
        }
        return res;
    }


#pragma region overload
    operator llong() { return val; }

    modint operator+() { return *this; }
    modint operator-() { return modint(modulo(-val)); }

    modint operator+(llong right) { return modint(modulo(val + modulo(right))); }
    modint operator-(llong right) { return *this + (-right); }
    modint operator*(llong right) { return modint(modulo(val * modulo(right))); }
    modint operator/(llong right) { return *this * pow(modint(right), MOD - 2); }
    
    modint &operator=(llong right) { return *this = modint(right); }
    modint &operator+=(llong right) { return *this = *this + right; }
    modint &operator-=(llong right) { return *this = *this - right; }
    modint &operator*=(llong right) { return *this = *this * right; }
    modint &operator/=(llong right) { return *this = *this / right; }

    modint &operator++() { return *this += 1; }
    modint &operator--() { return *this -= 1; }
    modint operator++(int) {
        modint ret = *this;
        ++(*this);
        return ret;
    }
    modint operator--(int) {
        modint ret = *this;
        --(*this);
        return ret;
    }
#pragma endregion
};


int N, K;


modint dp[2004][2004];
void make_combination(int n) {
    dp[0][0] = dp[0][2] = 0, dp[0][1] = 1;

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

int main(int argc, char **argv) {
    cin >> N >> K;

    //(N - K + 1 C i) * (K + i - 1 C K)
    make_combination(2001);

    for(int i = 1; i <= K; ++i) {
        modint res = 0;
        if(i <= K) {
            res = dp[N - K + 1][i + 1] * dp[K - 1][i];
        }

        cout << res << endl;
    }

}

Measured memory_bytes: 30208
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v){
    if(v.empty()){
        os<<"{ }";
        return os;
    }
    os<<"{"<<v.front();
    for(auto itr=++v.begin();itr!=v.end();itr++){
        os<<", "<<*itr;
    }
    os<<"}";
    return os;
}

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    string s; cin>>s;
    cout<<s;
    if(s.back()=='s') cout<<"es"<<endl;
    else cout<<"s"<<endl;
}


Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl "\n"
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
  string s;
  cin>>s;
  string ans;
  int mx=0;
  int cnt=0;
  for(int i=0;i<(int)s.size();i++){
	     (s[i]=='A' or s[i]=='G' or s[i]=='C' or s[i]=='T')?cnt++:cnt=0;
			  mx=max(mx,cnt);
	 }
   cout<<mx<<endl;
}
int32_t main(){
  IOS;
  solve();
  //debug();
 #ifdef LOCAL_DEFINE
 cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
 #endif	
}


Measured memory_bytes: 256
n,k=map(int,input().split())
v=[0]+list(map(int,input().split()))+[0]

ans=0

getl_sum=0
for lc in range(min(n,k)+1):
    getl_sum += v[lc]
    getr_sum =0
    for rc in range(min(n,k)-lc+1):
        getr_sum += v[-rc-1]
        get = v[:lc] + v[-rc-1:]
        get.sort()
        get_sum = getl_sum + getr_sum
        ans = max(ans,get_sum)
        for bc in range(min(lc+rc,k-lc-rc)):
            get_sum-=get[bc]
            ans = max(ans,get_sum)
print(ans)

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

X = 0

if math.ceil(A * (100 / 8)) >= math.ceil(B * 10):
    X = math.ceil(A * (100 / 8))
    if math.floor(X * 0.08) == A and math.floor(X * 0.1) == B:
        print(X)
    else:
        print(-1)
else:
    X = math.ceil(B * 10)
    if math.floor(X * 0.08) == A and math.floor(X * 0.1) == B:
        print(X)
    else:
        print(-1)

Measured memory_bytes: 3064
using System;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var d = int.Parse(_[0]);
            var n = int.Parse(_[1]);

            var count = 0;
            var i = 1;
            while(true){
                var c = 0;
                var x = i;
                while(true){
                    if(x % 100 == 0 && x / 100 != 0){
                        x /= 100;
                        c++;
                    }else{
                        break;
                    }
                }

                if(c == d){
                    count++;
                }
                if(count == n){
                    break;
                }
                i++;
            }

            Console.WriteLine(i);
        }
    }
}


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

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

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

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

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

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

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

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

class mint {
    long long x;
public:
    mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
    mint operator-() const {
        return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD - 2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res /= a;
    }

    friend ostream& operator<<(ostream& os, const mint& m) {
        os << m.x;
        return os;
    }
};

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

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    vector<vector<ll>> div(MAX);
    repn(i, MAX - 1) {
        for (ll j = i; j <= MAX-1; j+=i) {
            div[j].push_back(i);
        }
    }

    vector<mint> b(MAX,0);
    rep(i, N) {
        for (ll j : div[A[i]]) {
            b[j] += A[i];
        }
    }

    repn(i, MAX - 1) {
        b[i] = b[i] * b[i];
    }

   for(ll i=MAX-1; i>=1; i--) {
        for (ll j = i * 2; j <= MAX-1; j+=i) {
            b[i] -= b[j];
        }
    }

    mint ans = 0;
    repn(i, MAX - 1) ans += b[i] / i;

    rep(i, N) ans -= A[i];

    ans /= 2;

    cout << ans;


	system("PAUSE");
}

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


int main()
{
    int n,i,ans,j=0;
    cin>>n;
    int d[n],s[n],ms[n-1];
    for(i=0;i<n;i++){
        cin>>d[i];
    }
    for(i=0;i<n;i++){
        cin>>s[i];
    }
    for(i=0;i<n-1;i++){
        cin>>ms[i];
    }
    ans=s[d[0]-1];
    //cout<<ans<<endl;

    for(i=1;i<n;i++){
        ans+=s[d[i]-1];
      //  cout<<ans<<endl;
        if(d[i]-d[i-1]==1){
            ans+=ms[d[i-1]-1];

        }
    }
    cout<<ans;
}


Measured memory_bytes: 3640
z='abcdefghijklmnopqrstuvwxyz'
e=lambda x,i,j:z[(z.index(x)*i+j)%26]
def f():
 for i in range(1,26,2):
  for j in range(26):
   if''.join(e(c,i,j)for c in'that')in s or''.join(e(c,i,j)for c in'this')in s:return(i,j)
for _ in[0]*int(input()):
 s=input()
 k=f()
 print(s.translate(str.maketrans(''.join(e(c,*k)for c in z),z)))


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

int cnt[5];

int main() {
  
  int a,b,c,d,e,f;
  cin >> a >> b >> c >> d >> e >> f;

  cnt[a]++;
  cnt[b]++;
  cnt[c]++;
  cnt[d]++;
  cnt[e]++;
  cnt[f]++;
  bool flag = true;
  for ( int i = 1; i <= 4; i++ ) {
    if ( cnt[i] == 3 ) flag = false;
  }

  if (flag) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
const int maxn = 1e5 + 10;
using namespace std;

int n, k, a[maxn];

int main() {
	ios::sync_with_stdio(0);
	cin >> n >> k;
	int id;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
		if(a[i] == 1) id = i;
	}
	int ans = 0;
	for(int i = 1; i < n; i += k - 1) {
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

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

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r;
    cin>>r;
    if(r < 1200){
        cout<<"ABC"<<endl;
    }else if(r < 2800){
        cout<<"ARC"<<endl;
    }else{
        cout<<"AGC"<<endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var line = Console.ReadLine().Split(' ');

        var n = long.Parse(line[0]);
        var d = long.Parse(line[1]);

        var ans = 0;

        for(long i = 0; i < n; i++)
        {
            var line2 = Console.ReadLine().Split(' ');

            var x = long.Parse(line2[0]);
            var y = long.Parse(line2[1]);

            if (x * x + y * y <= d * d)
            {
                ans += 1;
            }
        }

        Console.WriteLine(ans);

        Console.ReadLine();
    }


}




Measured memory_bytes: 21968
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) {if(a<b) {a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) {if(a>b) {a=b;return 1;} return 0;}
const ll INF = 1LL<<60;

struct Edge{
    int from;
    int to;
    ll C;
};

ll solve() {
    ll N, M, P;
    cin >> N >> M >> P;
    vector<Edge> E(M);
    int a,b;
    ll c;
    for ( int i = 0; i < M; i++ ) {
        cin >> a >> b >> c;
        a--, b--;
        E[i] = Edge{a,b,c-P};
    }

    vector<ll> D(N, -INF);
    D[0] = 0;
    int cnt = 0;
    ll dmax = -INF;
    bool updated;
    while ( true ) {
        updated = false;
        for ( int i = 0; i < M; i++ ) {
            Edge e = E[i];
            if ( D[e.from] != -INF && D[e.to] < D[e.from] + e.C) {
                D[e.to] = D[e.from] + e.C;
                updated = true;
            }
        }
        if ( !updated ) return max(D[N-1],0LL);
        cnt++;
        if ( cnt > N ) {
            if ( dmax == -INF ) {
                dmax = D[N-1];
            } else {
                if ( dmax < D[N-1] ) return -1;
            }
        };
        if ( cnt > 2 * N ) return max(D[N-1],0LL);
    }
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define ll long long
using namespace std;

int main()
{
	int n, k, q;
	cin >> n >> k >> q;
	vector<int> point(n, 0);

	for (int i = 0; i < q; i++) {
		int answer;
		cin >> answer;
		answer--;
		point[answer]++;
	}

	for (int i = 0; i < n; i++) {
		printf("%s\n", point[i]-q+k>0?"Yes":"No");
	}

	return 0;
}




Measured memory_bytes: 1024
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int ans = 0;
		if(a >= b){
			ans += a;
			a -= 1;
		} else {
			ans += b;
			b -= 1;
		}
		if(a >= b){
			ans += a;
			a -= 1;
		} else {
			ans += b;
			b -= 1;
		}
		System.out.println(ans);
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int N;
    string s;
    int L, R, d;
    cin >> L >> R >> d;
    int cnt = 0;
    for (int i = L; i <= R; i++)
    {
        if (i % d == 0)
        {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3624
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

i64 a_[1000010];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    var(i64, K, N);
    vector<i64> p(N);
    read(p);
    sort(all(p));
    dump(p);

    i64 *a = a_ + 200010;
    rep(i, 0, N) {
        a[i] = p[i];
        a[i - N] = a[i] - K;
        a[i + N] = a[i] + K;
    }

    i64 ans = LINF;
    rep(i, 0, N) {
        const i64 x = abs(a[i] - a[i + N- 1]);
        const i64 y = K - abs(a[i] - a[i + N- 1]);
        dump(x, y);
        chmin(ans, x);
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 7936
import sys


def next_str() -> str:
    result = ""
    while True:
        next_chr = sys.stdin.read(1)
        if next_chr.strip() != "":
            result += next_chr
        elif next_chr != '\r':
            break
    return result


def next_int() -> int:
    return int(next_str())


n = next_int()
A = [next_int() for i in range(n)]
B = [next_int() for i in range(n)]

savings = 0


def main() -> None:
    global savings
    for i in range(n):
        c = B[i] - A[i]
        if c > 0:
            savings += c // 2
        else:
            savings += c

    print(["Yes", "No"][savings < 0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3828
#include <iostream>
#include <algorithm>  
#include <vector>    
#include <string>
using namespace std;
int main(void){
    int n;
    int total;
    int a,b,c;
    string x,y,z;
    bool flag = false;
    cin >> n >> total;
    for(a=0;a<=n;a++){
        int o = n-a;
        for(b=0;b<=o;b++){
            int p = o-b;
            for(c=0;c<=p;c++){
                int q = p-c;
                if(a*10000+b*5000+c*1000 == total && q == 0){
                    flag = true;
                    x = to_string(a);
                    y = to_string(b);
                    z = to_string(c);
                    break;
                }
            }
       }
    }
    if(flag == true){
        
        cout << x + " " + y + " " + z;
    }else{
        cout << "-1 -1 -1" << endl;
    
    }
    return 0;
}

Measured memory_bytes: 256