akhauriyash/Code-Regression huggingface dataset:
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

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

  int id = 0;
  vector<int> a(n);
  REP(i,n){
    cin >> a[i];
    if(a[i] <= 0) id++;
    if(a[i] == 0) k++;
  }
  //debug(id);
  vec L(n+1,INF), R(n+1,INF);
  L[0] = R[0] = 0;
  REP(i,id){
    L[id-i] = -a[i];
    if(a[i] == 0) id--;
  }

  FOR(i,id,n) R[i-id+1] = a[i];

  int ans = INF;
  REP(i,k+1){
    //cout << L[i] SP R[i] << endl;
    ans = min(ans,L[i]+R[k-i]+min(L[i],R[k-i]));
  }

  cout << ans << endl;

  return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> h (n);
    for(int i=0; i<n; i++){
        cin >> h.at(i);
    }
    int ans = 0;
    int x = 0;
    for(int i=0; i<n; i++){
        x = min(x,h.at(i));
        ans += h.at(i) - x;
        x = h.at(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

	public static void main(String[] args) {
		int N = sc.nextInt();
		int[] H = new int[N];
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		BIT bit = new BIT(N);
		int[] pos = new int[N];
		for (int i = 0; i < N; i++) {
			pos[H[i] - 1] = i;
		}
		for (int i = 0; i < N; i++) {
			int p = pos[i];
			long max = bit.cumulativeSum(p);
			bit.add(p + 1, max + A[p]);
		}
		long ans = 0;
		for (int i = 0; i <= N; i++) {
			ans = Math.max(ans, bit.v[i]);
		}
		System.out.println(ans);
	}

	static class BIT {
		long[] v;

		BIT(int size) {
			int len = 1;
			while (len < size) {
				len *= 2;
			}
			this.v = new long[len + 1];
		}

		long cumulativeSum(int index) {
			long ret = 0;
			while (index > 0) {
				ret = Math.max(ret, v[index]);
				index &= index - 1;
			}
			return ret;
		}

		void add(int index, long val) {
			while (index < v.length) {
				v[index] = Math.max(v[index], val);
				index += (index & -index);
			}
		}
	}


}

Measured memory_bytes: 99832
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define INF (1<<29)
using namespace std;
typedef long long ll;
int main(){
      string s;
      int n;
      int cnt=0;
      cin>>s;
      cin>>n;
      REP(i,n){
            string t;
            cin>>t;
            t+=t;
            REP(i,t.size()-s.size()){
                  if(t[i]==s[0]){
                        bool f=true;
                        REP(j,s.size()){
                              if(t[i+j]!=s[j])f=false;
                        }
                        if(f){
                              cnt++;
                              break;
                        }
                  }
            }
      }
      cout<<cnt<<endl;
}

Measured memory_bytes: 1212
#include<cstdio>
#include<vector>
using namespace std;
const int MAXN=1005;

int n;
long long A[MAXN];
bool keep[MAXN];

vector<int> ans;

void del(int pos)
{
	for(int i=pos;i<=n;i++)
		A[i]=A[i+1],keep[i]=keep[i+1];
	n--;
}

int main()
{
	scanf("%d",&n);
	bool flag=false;
	for(int i=1;i<=n;i++)
		scanf("%lld",A+i),flag|=(A[i]>0);
	if(flag==false)
	{
		int mx=-0x7FFFFFFF,pos;
		for(int i=1;i<=n;i++)
			if(mx<A[i])
				mx=A[i],pos=i;
		printf("%d\n%d\n",mx,n-1);
		for(int i=1;i<pos;i++)
			printf("1\n");
		for(int i=n-pos+1;i>=2;i--)
			printf("%d\n",i);
		return 0;
	}
	long long sum1=0,sum2=0;
	for(int i=1;i<=n;i+=2)
		if(A[i]>0)
			sum1+=A[i];
	for(int i=2;i<=n;i+=2)
		if(A[i]>0)
			sum2+=A[i];
	if(sum1>sum2)
	{
		for(int i=1;i<=n;i+=2)
			if(A[i]>0)
				keep[i]=true;
	}
	else
	{
		for(int i=2;i<=n;i+=2)
			if(A[i]>0)
				keep[i]=true;
	}
	
	while(n>1)
	{
		if(keep[1]==false)
		{
			ans.push_back(1);
			del(1);
			continue;
		}
		if(keep[n]==false)
		{
			ans.push_back(n);
			del(n);
			continue;
		}
		bool flag=false;
		for(int i=2;i<n;i++)
			if(keep[i-1]&&keep[i+1])
			{
				ans.push_back(i);
				A[i-1]+=A[i+1];
				del(i);
				del(i);
				flag=true;
				break;
			}
		if(flag)continue;
		for(int i=2;i<n;i++)
			if(!keep[i-1]&&!keep[i+1])
			{
				ans.push_back(i);
				A[i-1]+=A[i+1];
				del(i);
				del(i);
				break;
			}
	}
	printf("%lld\n",A[1]);
	printf("%d\n",(int)ans.size());
	for(int i=0;i<(int)ans.size();i++)
		printf("%d\n",ans[i]);
	
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
const int inf = 1000000007;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % inf;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), inf - 2, inf) % inf * mod_pow(kai(y), inf - 2, inf) % inf;
}

signed main() {
	int a, b;
	cin >> a >> b;
	cout << (a * 3 + b) / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1e9;

int N;
string S;
int main(){
    cin >> N >> S;
    int w = 0;
    REP(i,S.size()) if(S[i]=='.') ++w;

    int ans = w;

    int B = 0, W = w;
    REP(i,S.size()){
        if(S[i]=='#'){
            ++B;
        } else {
            --W;
        }
        chmin(ans,B+W);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
import math
a, b, C = map(int, input().split())
C = C / 180 * math.pi
S = a * b * math.sin(C) / 2
print(S)
print(a + b + math.sqrt(a**2 + b**2 - 2*a*b*math.cos(C)))
print(2 * S / a)

Measured memory_bytes: 7780
import sys
readline = sys.stdin.buffer.readline
arr = []
n,m= list(map(int,readline().rstrip().split()))
h = readline().rstrip().decode().split()
for i in range(m):
  k,l= list(map(int,readline().rstrip().split()))
  if int(h[k-1]) > int(h[l-1]):
    arr.append(l)
  elif int(h[k-1]) < int(h[l-1]):
    arr.append(k)
  else:
    arr.append(l)
    arr.append(k)
print(n-len(set(arr)))

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

void solve(long long N, long long K){
	if (K<=N/2+N%2) printf("YES\n"); else printf("NO\n");
}

int main(){
	long long N;
	long long K;
	scanf("%lld",&N);
	scanf("%lld",&K);
	solve(N, K);
	return 0;
}


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

using namespace std;
#define llu unsigned long long
#define ll long long
#define p pair<int,int>
#define M 1000000007
//sieve can be used here!
bool isPrime(int n){
	if(n==1)return false;//1 is not prime
	for(int i=2;i*i<=n;i++){
		if(n%i==0)return false;
	}
	return true;
}
bool myComp(p a,p b){
	if(a.first==b.first) return a.second<b.second;
	return a.first>b.first;
}
int row[]={-1,0,1,0};
int col[]={0,-1,0,1};
ll squareRoot(ll x){
	ll low=0;
	ll high=x;
	while(low<=high){
		ll mid= low+(high-low)/2;
		if((mid*mid)>x)high=mid-1;
		else if(mid*mid<x)low=mid+1;
		else return mid;
	}
	return low;
}
void dfs(char par,int r,int c,vector<vector<char>>& arr,vector<vector<bool>>& visited){
	int n=arr.size();
	int m=arr[0].size();
	visited[r][c]=true;
	arr[r][c]=par;
	for(int i=0;i<4;i++){
		int newRow=r+row[i];
		int newCol=c+col[i];
		if(newRow>=0&&newRow<n&&newCol>=0&&newCol<m&&!visited[newRow][newCol]&&arr[newRow][newCol]!='-'){
			if(par=='B') dfs('W',newRow,newCol,arr,visited);
			else dfs('B',newRow,newCol,arr,visited);
		}
	}
}
//DSu
int par[200003];
int sz[200003];
void initialiseDSU(){
	for(int i=0;i<200003;i++){
		par[i]=i;
		sz[i]=1;
	}
}
int find_root(int a){
	if(a==par[a])return a;
	par[a]=find_root(par[a]);
	return par[a];
}
int Union(int a,int b){//returns max size size after union
	int c=find_root(a);
	int d=find_root(b);
	if(c==d) return sz[c];
	if(sz[c]>sz[d]){
		par[d]=c;
		sz[c]+=sz[d];
		return sz[c];
	}
	else{
		par[c]=d;
		sz[d]+=sz[c];
		return sz[d];
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	initialiseDSU();
	int n,m;
	cin>>n>>m;
	int ans=INT_MIN;
	while(m>0){
		int a,b;
		cin>>a>>b;
		ans=max(ans,Union(a,b));
		m--;
	}
	if(ans!=INT_MIN)cout<<ans;
	else cout<<1;
	return 0;
}



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

int main()
{
	ll n;
	cin>>n;
	
	vector<ll>p;
	for(ll i=1;i<=n;i++)
	{
		p.push_back(i);
	}
	vector<ll>first;
	for(ll i=0;i<n;i++)
	{
		ll x;
		cin>>x;
		first.push_back(x);
	}
	vector<ll>second;
	for(ll i=0;i<n;i++)
	{
		ll y;
		cin>>y;
		second.push_back(y);
	}
	ll pos1 = 1;
	ll pos2 = 1;
	ll c = 1;
	do
	{
		bool e = true;
		for(ll i=0;i<n;i++)
		{
			if(first[i]!=p[i])
			{
				e = false;
				break;
			}
		}
		if(e)
		{
			pos1 = c;
		}
		
		bool f = true;
		for(ll i=0;i<n;i++)
		{
			if(second[i]!=p[i])
			{
				f = false;
				break;
			}
		}
		if(f)
		{
			pos2 = c;
		}
		c++;
	}
	while(next_permutation(p.begin(),p.end()));
	
	cout<<abs(pos1-pos2);
	return 0;
}

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

using namespace std;
#define REPP(i,a,b,c) for(int i=a; i<=b; i+=c)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,c) for(int i=a; i>=b; i-=c)
#define REV(i,a,b) REVV(i,a,b,1)
#define FOR(i,a) REP(i,0,(int)a-1)
#define FORD(i,a) REV(i,(int)a-1,0)
#define PB push_back
#define POB pop_back
#define FI first
#define SE second
#define MP make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef vector < int > vi;
typedef vector < pii > vii;
typedef vector < ll > vl;
typedef pair < ll , ll > pll;

const double PI = acos(-1);
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;
const int INF = 1e9;
	

ll addMod(ll a, ll b){
	if(a + b >= MOD) return a + b - MOD;
	return a + b;
}

ll mulMod(ll a, ll b){
	return (a*b)%MOD;
}

ll fast(ll a, ll b){
	if(b == 0) return 1;
	ll tmp = fast(a,b/2);
	tmp = mulMod(tmp,tmp);
	if(b%2 == 1) tmp = mulMod(tmp,a);
	return tmp;
}

ll GCD(ll a, ll b){
	if(a > b) return GCD(b,a);
	if(a == 0) return b;
	return GCD(b%a,a);
}

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

int n,m;
vii ans;
void solve(){
	if(m > (n-1) * (n-2) / 2){
		cout << -1 << endl;
		return;
	}
	int cnt = (n-1) * (n-2) / 2;
	REP(i,2,n){
		ans.PB(MP(1,i));
	}
	int dif = 1;
	while(cnt > m){
		
		REP(i,2,n-dif){
			ans.PB(MP(i,i+dif));
			cnt--;
			if(cnt == m) break;
		}
		dif++;
	}
	cout << ans.size() << endl;
	FOR(i,ans.size()){
		cout << ans[i].FI << " " << ans[i].SE << endl;
	}
}

int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	solve();
	return 0;
}

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

int main(int argc, char const *argv[]){
	int n,x;
	int temp,cnt = 0;
	cin >> n >> x;
	vector<int> a(n),b(n);
	for (int i = 0; i < n; ++i)	cin >> a.at(i);
	for (int i = 0; i < n; ++i)	b.at(i) = 0;
	sort(a.begin(), a.end());
	for (int i = 0; i < n; ++i)
	{
		temp = (a[i] <= x) ? a[i] : x;
		b[i] += temp;
		x -= temp;
	}
	if(x > 0) cnt = -1;
	for (int i = 0; i < n; ++i)
	{
		if(a[i] == b[i])	++cnt;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
public class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        int a,b,m,tmpx,tmpy;
        a=scan.nextInt();
        b=scan.nextInt();
        m=scan.nextInt();
        int[] aa=new int[a];
        int[] bb=new int[b];
        for(int i=0;i<a;i++){
            aa[i]=scan.nextInt();
        }
        for(int i=0;i<b;i++){
            bb[i]=scan.nextInt();
        }
        int[] sum_c =new int[m];
        for(int i=0;i<sum_c.length;i++){
            tmpx=scan.nextInt()-1;
            tmpy=scan.nextInt()-1;
            //System.out.println(tmpx+" "+tmpy+" "+aa[tmpx]+" "+bb[tmpy]);
            sum_c[i]=aa[tmpx]+bb[tmpy]-scan.nextInt();
            //System.out.println(sum_c[i]);
        }
        Arrays.sort(aa);
        Arrays.sort(bb);
        Arrays.sort(sum_c);
        System.out.println(Math.min(aa[0]+bb[0],sum_c[0]));
    }
}

Measured memory_bytes: 131404
#include <bits/stdc++.h>
#define pq priority_queue
#define mp make_pair
#define cauto const auto &

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#define clr(ar, val) memset(ar, val, sizeof(ar))

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

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

typedef long long int64;
typedef long long lint;
typedef long long lli;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;

const int iinf = 1 << 29;
const long long linf = 1ll << 61;

ll n, ans;
int main() {
    cin >> n;
    ll a[n];
    REP(i, n) {
        cin >> a[i];
        a[i] -= i;
    }
    sort(a, a + n);
    ll mid = a[n / 2];

    // if (n % 2)
    //     REP(i, n) { ans += abs(a[i] - mid); }
    // else{
    //     ll ans1=0,ans2=0;
    //     REP(i,n){
    //         ans1+=abs(a[i]-mid);
    //     }
    // }
    REP(i, n) { ans += abs(a[i] - mid); }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 1792
n = int(raw_input())
s = raw_input()

if n % 2 != 0:
    print "No"
    exit(0)

s_1 = s[0:(n/2)]
s_2 = s[(n/2):]


if s_1 == s_2:
    print 'Yes'
else:
    print 'No'


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

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

using namespace std;

int R,C,HPinit,HPmax,T,S,P,cost[30],iG[200][200],p[12],dp[1<<12];
char G[200][200];

int main(){
  while( cin >> HPinit >> HPmax, HPinit | HPmax){
    cin >> R >> C;
    rep(i,R) rep(j,C) cin >> G[i][j];
    cin >> T;
    rep(i,T) {
      char c; 
      cin >> c;
      cin >> cost[c-'A'];
    }
    rep(i,R) rep(j,C) iG[i][j] = cost[G[i][j]-'A'];
    cin >> S;
    deque<int> damage;
    int x = 0,y = 0;
    rep(i,S){
      char dir;
      int n, dx = 0, dy = 0;
      cin >> dir >> n;
      if( dir == 'U' )      dy--;
      else if( dir == 'D' ) dy++;
      else if( dir == 'R' ) dx++;
      else                  dx--;
      rep(_,n){
        x += dx, y += dy;
        assert( 0 <= x && x < C && 0 <= y && y < R );
        if( iG[y][x] != 0 ) damage.push_back(iG[y][x]);
      }
    }
    cin >> P;
    rep(i,P) cin >> p[i];
    assert((int)damage.size() <= 1000);
    rep(i,(1<<P)) dp[i] = 0;
    dp[0] = HPinit;
    rep(i,(int)damage.size()){
      rep(j,(1<<P))if(dp[j]>0){
        rep(k,P)if( !( (j>>k) & 1 ) ){
          dp[j|(1<<k)] = max(dp[j|(1<<k)],
                             min(HPmax,dp[j]+p[k]));
        }
      }
      rep(j,(1<<P)) dp[j] -= damage[i];
    }
    bool ok = false;
    rep(i,(1<<P)) if( dp[i] > 0 ) {
      ok = true;
      break;
    }
    cout << (ok?"YES":"NO") <<endl;
  }
  return 0;
}

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

int main() {
    int a, b, x;  cin >> a >> b >> x;
    if (x >= a && x <= a+b)  cout << "YES" << endl;
    else  cout << "NO" << endl;
}

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

public class Main
{
	public static void main(String[] args) throws NumberFormatException, IOException
	{
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String A = str.substring(0, 1);
		String B = str.substring(2, 3);
		if(A.equals(B)) System.out.println("Yes");
		else System.out.println("No");
	}
}


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

int main(){
  int n;
  cin >> n;
  int a = n;
  bool ok = false;
  while(n>0){
    if(n%7 == 0) ok = true;
    n -= 4;
  }
  while(a>0){
    if(a%4 == 0) ok = true;
    a -= 7;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
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;}

bool seen[200010];
int dd[2000010];

int r,nr;
int dfs(vector<int> a,ll k,int n){
   seen[1] = true;
   dd[1]=0;
   int next = a[1];
   ll cnt=0;
   while(true){
      cnt++;
      
      if(k==cnt){
         cout << next << endl;//end
         return 0;
      }

      if(!seen[next]){
         seen[next] = true;
         dd[next] = cnt;
         next = a[next];
         
      }else{
         ll ans;
   
         r = cnt-dd[next];
         nr = dd[next];
         int index =nr+(k-nr)%r;
        
         for(ll i=1;i<=n;i++){
             if(index==dd[i]) ans =i;
         }
         cout << ans << endl;//end
         return 0;
      }
      
   }

}
int main(){
   int n;
   ll k;
   cin >> n >> k;
   vector<int>a(n+1);
   rep(i,n) cin >> a[i+1];
   memset(seen,false,sizeof(seen));
   memset(dd,-1,sizeof(dd));
   int b = dfs(a,k,n);
   return 0;
}


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

int a[3100];
long long dp[3100][3100] = {0};


int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int d = 1; d <= n; ++d) {
    for (int i = 0; i + d <= n; ++i) {
      dp[i][i + d] = max(a[i] - dp[i + 1][i + d], a[i + d - 1] - dp[i][i + d - 1]);
    }
  }
  cout << dp[0][n] << '\n';
}


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

int foo(int k, int n){
    return ((n - 1) / k + 1) * k;
}

int main()
{
    int n;
    cin >> n;
    int c[500], s[500], f[500];
    for(int i = 0; i < n - 1; i++){
        cin >> c[i] >> s[i] >> f[i];
    }
    for(int i = 0; i < n; i++){
        int ans = 0;
        for(int j = i; j < n - 1; j++){
            ans = max(s[j], foo(f[j], ans)) + c[j];
        }
        cout << ans << endl;
    }
}

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

int main() {
	int N;
	int L[1000];
	int X;
	int D=0;
	int count=0;
	scanf("%d%d", &N,&X);
	for (int i = 0; i < N; i++)scanf("%d", &L[i]);

	for (int i = 0; i < N; i++) {
		if (D <= X)count++;
		else break;
		D += L[i];
		if (i == N - 1 && D <= X)count++;
	}


	printf("%d",count);

}









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

using namespace std;

int main(void) 
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string s;
	int res = 0;

	cin >> s;

	for(int i=0;i<6;i++)
	{
		if(s[i]=='1')
		{
			res++;
		}
	}

	cout << res << '\n';

	return 0;
}	



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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;


int main() {
ll a,v,b,w,t;
cin>>a>>v>>b>>w>>t;
int way = abs(a-b),s=(v-w);
if(a==b){
    cout<<"YES"<<endl;
}
else if(way-t*s<=0){
    cout<<"YES"<<endl;
}
else
{
    cout<<"NO"<<endl;
}


}

Measured memory_bytes: 3592
#include <iostream>
using namespace std;
int main(){
    char a[4];
    for(int i=0;i<4;i++){
        cin >> a[i];
    }
    if(a[1]==a[2]){
        if(a[0]==a[1]||a[2]==a[3]){
        cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while(true) {
            int m = input.nextInt();
            int f = input.nextInt();
            int r = input.nextInt();
            int gokei = m + f;
            if(m == -1 && f == -1 && r == -1){
                break;
            }
            if (m == -1 || f == -1) {
                System.out.println("F");
            }else if (gokei >= 80){
                System.out.println("A");
            }else if (gokei < 80 && gokei >= 65){
                System.out.println("B");
            }else if (gokei < 65 && gokei >= 50){
                System.out.println("C");
            }else if (gokei < 50 && gokei >= 30 && r >= 50){
                System.out.println("C");
            }else if (gokei < 50 && gokei >= 30){
                System.out.println("D");
            }else if (gokei < 30){
                System.out.println("F");
            }
        }
    }
}


Measured memory_bytes: 26140
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(a,n) rep(i,0,n){ cout<<(i ? " ":"")<<a[i]; }cout<<endl;
const int mod = 1e9+7;
const int size=1e5;
const int INF=1e9;
int main(){
	int A,B;cin>>A>>B;
    if(A==1) A=14;
    if(B==1) B=14;
	if(A==B) cout<<"Draw"<<endl;
	else if(A>B) cout<<"Alice"<<endl;
	else cout<<"Bob"<<endl;
}

Measured memory_bytes: 256
// SeeAlso: https://atcoder.jp/contests/abc138/tasks/abc138_e

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

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

    bool flag = true;
    for(ll i=0;i<t.size();i++){
        if (s.find(t[i]) == -1) {
            flag = false;
            break;
        }
    }   
    if (!flag) {
        print("-1");
        return 0;
    }
    ll ans = 0;
    string temp = s;
    for(ll i=0;i<t.size();i++){        
        ll length = temp.find(t[i]);
        if(length==-1) {
            temp += s;
            length = temp.find(t[i]);
        }
        temp.erase(temp.begin(), temp.begin()+length+1);
        ans += (length+1);        
    }

    ll length = temp.find(t[t.size()]);
    
    print(ans);
    return 0;
}


Measured memory_bytes: 768
'use strict'

const main = (input) => {
    input = input.split('\n');

    const N = Number(input[0]);
    const Vs = input[1].split(' ').map((A) => Number(A));
    Vs.sort((a, b) => a - b);

    let ans = (Vs[0] + Vs[1]) / 2;

    for (let i = 2; i < N; i++) {
        ans += Vs[i];
        ans /= 2;
    }

    console.log(ans);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max({a * c, b * d, a * d, b * c});
	return 0;
}

Measured memory_bytes: 3572
/*Arnab's Code
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define vll vector<ll>
#define vii vector<int>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define take(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define takes(a,n,st) for(ll i=st;i<n+st;i++)cin>>a[i]
ll sum(ll a[],ll n,ll s){ for(ll i=0;i<n;i++)s+=a[i]; return s;}
#define mod 1000000009
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;  
}
ll a[200017];
void solve(){
	ll n,t,rt,prev,i;
	cin>>n>>t;
	take(a,n);
	rt=0;
	prev=0;
	for(i=1;i<n;i++){
		rt+=min(t,a[i]-prev);
		prev=a[i];
	}
	rt+=t;
	cout<<rt;
	return;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ll t,T;
//	cin>>T;
	T=1;
	for(t=1;t<=T;t++){
//		cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 5156
import sys
def input():
    return sys.stdin.readline()[:-1]
H,W,N=map(int,input().split())
d={}
for i in range(N):
    a,b=map(int,input().split())
    for j in range(-1,2):
        if not 1<a+j<H:
            continue
        for k in range(-1,2):
            if not 1<b+k<W:
                continue
            t=(a+j,b+k)
            if t in d:
                d[t]+=1
            else:
                d[t]=1
l=[0]*10
for i in d.values():
    l[i]+=1
l[0]=(H-2)*(W-2)-sum(l)
print(*l,sep="\n")

Measured memory_bytes: 139768
const [nk, pStr] = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\n/)
const [n, k] = nk.split(/\s/).map(Number)
const ps = pStr.split(/\s/).map(Number)
ps.sort((a, b) => a - b)
let result = 0
for (let i = 0; i < k; i++) {
  result += ps[i]
}
console.log(result)

Measured memory_bytes: 29608
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Data.List
import Data.Char

main :: IO ()
main = do
    (n,m) <- (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 readInt <$> BS.getLine
    as <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    let aList = sortBy (\j k -> compare k j) as
    putStrLn $ if (4*m*(aList !! (m-1))) >= sum aList then "Yes" else "No"

readInt :: BS.ByteString -> Maybe (Int,BS.ByteString)
readInt = BS.readInt . BS.dropWhile isSpace

Measured memory_bytes: 508
n = int(input())
alist = list(map(int, input().split()))

is_positive = True
operation_count = 0


def run(is_positive):
    tmp_sum = 0
    operation_count = 0
    for a in alist:
        tmp_sum += a
        if is_positive:
            if tmp_sum <= 0:
                operation_count += -tmp_sum + 1
                tmp_sum = 1
        else:
            if tmp_sum >= 0:
                operation_count += tmp_sum + 1
                tmp_sum = -1
        is_positive = not is_positive
    return operation_count


print(min(run(True), run(False)))


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

using namespace std;

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

int n, factorial[N], ways_down[N], ways_up[N], ways_all[N], size[N];
vector<int> adj[N];

int power(int base, int exponent) {
    if (exponent == 0) return 1;
    long long res = power(base, exponent / 2);
    res = res * res % MOD;
    if (exponent % 2 == 1) {
        res = res * base % MOD;
    }
    return res;
}

int choose(int n, int k) {
    long long res = factorial[n];
    res = res * power(factorial[n - k], MOD - 2) % MOD;
    res = res * power(factorial[k], MOD - 2) % MOD;
    return res;
}

void dfs_1(int u, int parent) {
    ways_down[u] = 1;
    size[u] = 1;
    for (int v : adj[u]) {
        if (v == parent) continue;
        dfs_1(v, u);
        size[u] += size[v];
        ways_down[u] = 1LL * ways_down[u] * choose(size[u] - 1, size[v]) % MOD * ways_down[v] % MOD;
    }
}

void dfs_2(int u, int parent) {
    if (parent == -1) {
        ways_up[u] = 1;
    } else {
        // ways_up[u] = 1LL * ways_all[parent] * power(choose(size[parent] - 1, size[u]), 2) % MOD * size[u] % MOD * (size[parent] - 1) % MOD;
        ways_up[u] = 1LL * ways_up[parent] 
            * ways_down[parent] % MOD * power(1LL * choose(size[parent] - 1, size[u]) * ways_down[u] % MOD, MOD - 2) % MOD
            * choose(n - size[u] - 1, n - size[parent]) % MOD;
    }
    ways_all[u] = 1LL * ways_down[u] * choose(n - 1, n - size[u]) % MOD * ways_up[u] % MOD;
    for (int v : adj[u]) {
        if (v == parent) continue;
        dfs_2(v, u);
    }
}



void precalculate(int n) {
    factorial[0] = 1;
    for (int i = 1; i <= n; ++ i) {
        factorial[i] = 1LL * factorial[i - 1] * i % MOD;
    }
}

int main() {
    scanf("%d", &n);
    precalculate(n);
    for (int i = 1; i <= n-1; ++ i) {
        int a, b;
        scanf("%d%d", &a, &b);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    dfs_1(1, -1);
    dfs_2(1, -1);
    // printf("n = %d\n", n);
    // for (int u = 1; u <= n; ++ u) {
    //     // printf("%d %d\n", ways_down[u], ways_up[u]);
    //     cerr << ways_up[u] << ' ' << ways_down[u] << '\n';
    // }
    for (int u = 1; u <= n; ++ u) {
        printf("%d\n", ways_all[u]);
    }

}

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

typedef long long ll;

ll res[100005];
ll niz[100005];

int main(){
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> niz[i];
    }
    deque <int> q;
    for(int i=n; i>=1; i--){
        while(!q.empty() && niz[q.back()] <= niz[i]) q.pop_back();
        q.push_back(i);
    }
    q.push_back(0);
    priority_queue <int> pq;
    int cnt = 1;
    int rr = q.front();
    for(int i=n; i>rr; i--) pq.push(niz[i]);
    while(q.size() >= 2){
        int i = q.front();
        q.pop_front();
        int j = q.front();
        ll tren = niz[i];
        while(!pq.empty() && pq.top() > niz[j]){
            res[i] += (tren-pq.top())*cnt;
            cnt++;
            tren = pq.top();
            pq.pop();
        }
        res[i] += (tren-niz[j])*cnt;
        tren = niz[j];
        for(int k=i-1; k>j; k--){
            pq.push(niz[k]);
        }
        pq.push(tren);
    }
    for(int i=1; i<=n; i++){
        cout << res[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 3072
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MaxN 500000+100
int dp[MaxN]; 
int number[MaxN];
int last=0;
int max(int a,int b)
{
	return a>b ? a :b;
}
int main()
{
	int N;
	scanf("%d",&N);
	for(int i=1;i<=N;i++)
		scanf("%1d",&number[i]);
	for(int i=3;i<=N;i++)
	{
		dp[i]=dp[i-1];
		if(number[i]==1 && number[i-1]==0 && number[i-2]==1)
		{
			last=i;
			for(int q=i-2;q>=1 && number[q]!=0;q--)
				dp[i]=max(dp[i],dp[q-1]+i-1-q); 
		}
		if(number[i]==0)
			last=0;
		if(last)
		{
			dp[i]=max(dp[i],dp[last-3]+i-last+1);
		}
	}
	printf("%d\n",dp[N]);
	return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <math.h>
#include <algorithm>
#include <set>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const ll MAX_L = (ll)1 << 62;

ll f = 0;
ll s = 0;
ll o = 0;
int main() {
	ll n; cin >> n;
	repe(i, 1, n) {
		ll x; cin >> x;
		if (!(x % 4))f++;
		else if (!(x % 2))s++;
		else o++;
	}
	if (f >= o) {
		cout << "Yes" << endl;
	}
	else {
		if (o - f == 1 && s == 0) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <utility>

static const size_t N_MAX = 100;

int main() {
  size_t N;
  int A[N_MAX];
  scanf("%zu", &N);
  for (size_t i = 0; i < N; i++)
    scanf("%d", &A[i]);
  int c = 0;
  for (size_t i = 1; i < N; i++)
    for (size_t j = i; j > 0 && A[j] < A[j-1]; j--, c++)
      std::swap(A[j], A[j-1]);
  for (size_t i = 0; i < N - 1; i++)
    printf("%d ", A[i]);
  printf("%d\n", A[N-1]);
  printf("%d\n", c);
  return 0;
}

Measured memory_bytes: 2720
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
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; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


 
void solve(){
    char a;
    cin>>a;
    if(a=='a'||a=='i'||a=='u'||a=='e'||a=='o') cout<<"vowel"<<endl;
    else cout<<"consonant"<<endl;
}
 
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
     
    ll Q=1;
    // cin>>Q;
    rep(_,Q){
 
        solve();
 
    }
   
 
 
    return 0;
}

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
    int n,k;
    cin>>n>>k;
    map<int,int>mp;
    while(k--)
    {
        int x;
        cin>>x;
        for(int i=1;i<=x;i++)
        {
            int y;
            cin>>y;
            mp[y]++;
        }
    }
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        if(!mp[i])
            cnt++;
    }
    cout<<cnt<<'\n';


}


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

int main() {
  long long N;
  cin >> N;
  vector<vector<int>> vec(11, vector<int>(11));
  
  for(int i = 1; i <= N; i++){
    int a,b,tmp;
    tmp = i;
    while(tmp){
      a = tmp;
      tmp /= 10;
    }
    b = i%10;
    vec.at(a).at(b)++;
  }
  int ans=0;
  for(int i = 1; i < 10; i++){
    for(int j = 1; j < 10; j++){
      ans += vec.at(i).at(j)*vec.at(j).at(i);
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main(){
	var N int
	fmt.Scan(&N)
	w := make([] int, N)
	sum := 0
	for i := 0; i < N; i++ {
		fmt.Scan(&w[i])
		sum += w[i]
	}
	//fmt.Println(sum)
	tmpSum := sum
	sum_w := 0
	for i := 0; i < N; i++ {
		sum_w += w[i]
		tmpSum = int(math.Min(float64(tmpSum),
			math.Abs(float64(sum_w) - (float64(sum) - float64(sum_w)))))
	}
	fmt.Println(tmpSum)

}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    //lol result{0};
    lol n; cin >> n;
    //int k; cin >> k;
    /*
    vector<int> a(n);
    REP(i, n)
    {
        cin >> a[i];
    }
    */
    if(n >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    

    //cout << result << endl;
    return 0;
}

Measured memory_bytes: 3592
import numpy as np
A, B = map(int,input().split())
A,B=int(A),int(B)
c=0
d=True
while(d):
    a=int(c*0.08)
    b=int(c*0.1)
    if a==A and b==B:
        print(c)
        d=False
    elif a>A or b>B:
        print('-1')
        d=False
    else:
        c+=1 
        continue

Measured memory_bytes: 20604
from itertools import combinations
n,d = map(int,input().split())
L = list(list(map(int,input().split())) for _ in range(n))
C = list(combinations(L,2))
ans = 0
for i in range(len(C)):
  total = 0
  for a,b in zip(C[i][0],C[i][1]):
    total += abs(a - b)**2
  
  if (total**0.5)%1 == 0:
    ans += 1
print(ans)

Measured memory_bytes: 9452
#include<bits/stdc++.h>
using namespace std;
 
#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}
void input(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}
void swap(int& a, int& b){
	int t=a;
	a = b;
	b = t;
}
 
void solveTest(){
	int n,x;
	cin>>x>>n;
	if(n==0){
		cout<<x<<endl;
		return;
	}
	set<int>st;
	for(int i=0;i<n;i++) {
		int p;
		cin>>p;
		st.insert(p);	
	}
	if(st.find(x)==st.end()){
		cout<<x<<endl;
		return;
	}
	int l = x-1;
	int r = x+1;
	while(1){
		if(st.find(l)==st.end()){
			if(st.find(r)==st.end()){
				if(abs(l-x)<=abs(r-x)){
					cout<<l<<endl;
					return ;
				}
				else {
					cout<<r<<endl;
					return;
				}
			}
			else{
				cout<<l<<endl;
				return;
			}
		}
		else if(st.find(r)==st.end()){
			if(st.find(l)==st.end()){
				if(abs(l-x)<=abs(r-x)){
					cout<<l<<endl;
					return;
				}
				else{
					cout<<r<<endl;
					return;
				}
			}
			else {
				cout<<r<<endl;
				return;
			}
		}
		l--;
		r++;
	}
	return ;
}
 
int main(){
	fastio();
	//input();
 
	int t=1;
	//cin>>t;
	while(t--){
		solveTest();
 
	}
	
	return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
struct Edge {
    int to;
    int weight;
    Edge(int t, int w)
        : to(t)
        , weight(w)
    {
    }
};
using Graph = vector<vector<int>>;
using Graph_e = vector<vector<Edge>>;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

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;
}

// 負の数にも対応した % 演算
long long mod(long long val, long long m)
{
    long long res = val % m;
    if (res < 0)
        res += m;
    return res;
}

// a^n modを計算する
long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    // nを2進数表示して1が埋まっている桁に関してはa^mをかけていく
    while (n > 0) {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod)
{
    return modpow(a, mod - 2, mod);
}

int main()
{
    string alphabet = "abcdefghijklmnopqrstuvwxyz";

    char input;
    cin >> input;
    for (int i = 0; i < 26; i++) {
        if (alphabet.at(i) == input) {
            cout << alphabet.at(i + 1) << endl;
        }
    }
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

ll n;

int main() {
	cin >> n;
	
	ll ans = 114514;
	for (ll i = 1; i <= sqrt(n); ++i) {
		if (n%i==0) {
			chmin(ans, max((ll)to_string(i).length(), (ll)to_string(n/i).length()));
		}
	}
	cout << ans << ln;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		int n = sc.nextInt() + 1;

		int[][] d = new int[n][n];
		for (int i = 0; i < n; i++) {
			Arrays.fill(d[i], Integer.MAX_VALUE >> 3);
		}
		for (int i = 1; i < n; i++) {
			int r = sc.nextInt();
			int k = sc.nextInt();
			for (int j = 0; j < k; j++) {
				int z= sc.nextInt();
				d[r][z] = 1;
			}
		}

		boolean end = false;
		for (; !end;) {
			end = true;
			for (int i = 1; i < n; i++) {
				for (int j = 1; j < n; j++) {
					for (int k = 1; k < n; k++) {
						if (d[i][j] > d[i][k] + d[k][j]) {
							d[i][j] = d[i][k] + d[k][j];
							end = false;
						}
					}
				}
			}
		}
		
		int p = sc.nextInt();
		for(int i = 0; i < p ; i++){
			int s = sc.nextInt();
			int g = sc.nextInt();
			int v = sc.nextInt();
			
			
			System.out.println(d[s][g] + 1 > v ? "NA":(d[s][g]+1)  );
		}
	}

	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 12000
//package AtCoder.ABC158;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        long n = in.NL(), b = in.NL(), r = in.NL();
        if (r==0 && b==0) {
            out.println(0);
        } else if (b==0) {
            out.println(0);
        } else if (r==0) {
            out.println(n);
        } else {
            long div = n/(r+b);
            long ans = 0;
            ans = ans + div * b;
            long rem = n % (r+b);
            ans = ans + Long.min(rem, b);
            out.println(ans);
        }
        out.close();
    }

    static InputStream inputStream = System.in;
    static OutputStream outputStream = System.out;
    static InputReader in = new InputReader(inputStream);
    static PrintWriter out = new PrintWriter(outputStream);

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

        public int NI() {
            return Integer.parseInt(next());
        }

        public long NL() {
            return Long.parseLong(next());
        }

    }
}

Measured memory_bytes: 23252
def GCD(a, b):
    b %= a
    return b if a%b == 0 else GCD(b, a)
        

while True:
    try:
        a, b = list(map(float, input().split()))
    except EOFError:
        break
    if a >= b:
        a, b = b, a
    gcd = GCD(a, b) if b%a != 0 else a
    print("{0} {1}".format(int(gcd), int(a*b/gcd)))

Measured memory_bytes: 7468