akhauriyash/Code-Regression huggingface dataset:
<?php

fscanf(STDIN,"%d %d",$x,$y);
if($y/$x==4){
    echo "Yes";
}elseif($y%2==0){
    $kame=($y-2*$x)/(4-2);
    if($kame>=$x){
        echo "No";
    }elseif($kame<0){
        echo "No";
    }else{
        echo "Yes";
    }
}else{
    echo "No";
}

Measured memory_bytes: 16148
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front

using ll = long long;
using namespace std;

ll M = 1000000007;

void solve(){
  int n;
  cin>>n;
  vector<int>a(n);
  bool ok=true;
  rep(i,n){
    cin>>a[i];
    if(a[i]%2==0){
      if(a[i]%3!=0&&a[i]%5!=0){
        ok=false;
      }
    }
  }
  if(ok){
    cout<<"APPROVED"<<endl;
  }
  else{
    cout<<"DENIED"<<endl;
  }

}


int main()
{
  solve();
}

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

int main()
{
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i = 0; i < n; i++)
    {
        cin>>v[i];
    }
    int count = 0;
    int even = 0;
    for(int i = 0; i < n; i++)
    {
        if(v[i]%2==0)
        {
            even++;
            if(v[i]%3== 0 || v[i]%5==0)
            {
                count++;
            }
            else
            {
                cout<<"DENIED";
                break;
            }
        }
        continue;
    }
    if(even==count)
    {
        cout<<"APPROVED";
    }
    return 0;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> w(n);
  int s1 = 0;
  for(int i=0;i<n;i++){
    cin>>w.at(i);
    s1+=w.at(i);
  }
  int s2 = 0;
  int count = 0;
  for(int i=0;i<n;i++){
    s2+=w.at(i);
    s1-=w.at(i);
    if(s2>=s1){
      break;
    }
    else{
      count++;
    }
  }
  if(s2-s1>(s1+w.at(count))-(s2-w.at(count))){
    cout<<(s1+w.at(count))-(s2-w.at(count))<<endl;
  }
  else{
    cout<<s2-s1<<endl;
  }
  return 0;
}

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

#define MAX  20

int n, A[MAX];

int solve(int i, int m){
    if(m == 0) return 1;
    if(i >= n) return 0;
    int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
}

int main(){
    cin >> n;
    rep(i,n) cin >> A[i];

    int q, m;
    cin >> q;
    for(int i = 0; i < q; i++){
        cin >> m;
        if(solve(0,m)){
            cout << "yes" << endl;
        }else{
            cout << "no" << endl;
        }
    }

    return 0;
}


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

namespace abc117_a
{
    class Program
    {
        public static double Time(int T, int X)
        {
            double time = (double)T / X;
            return time;
        }

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int T = int.Parse(input[0]);
            int X = int.Parse(input[1]);

            Console.WriteLine(Time(T, X));
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>


using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()

int main()
{
	ll n, m; cin >> n >> m;
	ll ans = min(n, m / 2);
	m -= ans * 2;
	ans += m / 4;
	cout << ans << endl;
}

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


int main() {
    int q;
    cin>>q;
    
    while(1){
        //cout<<q<<endl;
        if(!q)break;
        string x,y;
        cin>>x>>y;
        int n=x.size();
        int m=y.size();
        int dp[1050][1050];
        for(int i=1;i<=m;i++){
            rep(j,n+1){
               dp[j][i]=0;
            }
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(x[i]==y[j]){
                    dp[i+1][j+1] =  dp[i][j] + 1;
                }
                else{
                    dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
                }
            }
        }cout<<dp[n][m]<<endl;
        q--;
    }
    
    
    return 0;
}


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

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    int a, b;
    cin >> a >> b;

    if(a > b)
        swap(a, b);
    
    while(b--)
        cout << a;

    return 0;
}


Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

const ll INF = 1LL << 50;

const ll mod = 1000000007;

int main() {
  ll h, w;
  cin >> h >> w;

  vector<string> mp(h);
  rep(i, h) cin >> mp[i];

  ll n = h * w;
  vvll eds(n, vll(n, INF));
  rep(i, n) eds[i][i] = 0;

  for (ll i = 0; i < n; i++) {
    ll y = i / w;
    ll x = i % w;
    if (mp[y][x] == '.') {
      for (ll k = 0; k < 4; k++) {
        bool cond = y + dy[k] >= 0 && y + dy[k] < h;
        cond &= x + dx[k] >= 0 && x + dx[k] < w;
        if (cond && mp[y + dy[k]][x + dx[k]] == '.') {
          ll j = (y + dy[k]) * w + x + dx[k];
          eds[i][j] = 1;
          eds[j][i] = 1;
        }
      }
    }
  }

  rep(k, n) rep(i, n) rep(j, n) chmin(eds[i][j], eds[i][k] + eds[k][j]);

  ll ans = 0;
  rep(i, n) rep(j, n) {
    if (i == j || eds[i][j] == INF) continue;
    chmax(ans, eds[i][j]);
  }
  assert(ans != 0);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define x first
#define y second
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ve vector
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define sz(a) (int)(a.size())
//using namespace __gnu_pbds;
using namespace std;

// // // functions: find_by_order  & order_of_key
// typedef tree<
// int,
// null_type,
// less<int>,
// rb_tree_tag,
// tree_order_statistics_node_update>
// ordered_set;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

const int inf=(int)2e9;
const long long mod=1000000007; //1E9+7
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

ll powmod(ll a,ll p){
	ll ans=1;
	while(p){
		if(p&1) ans*=a;
		p/=2;a*=a; ans%=mod;a%=mod;
	}
	return ans;
}
ll mdinv(ll a){return powmod(a,mod-2); }

signed main(){
	IOS
	int k;
	int n;cin>>n>>k;
	vi h(n),d(n);
	forn(i,n) cin>>h[i];
	d[n-1]=0;d[n-2]=abs(h[n-1]-h[n-2]);
	for(int i=n-3;i>=0;i--){
		d[i]=INT_MAX;
		for(int a=1;a<=k && i+a<n;a++)
		d[i]=min(d[i+a]+abs(h[i]-h[i+a]),d[i]);
	}
	cout<<d[0];
}


Measured memory_bytes: 1792
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	var line string
	fmt.Scan(&line)
	arr := make([]int, 0)
	cnt := 1
	if string(line[0]) == "0" {
		arr = append(arr, 0)
	}
	for i := 0; i < n - 1; i++ {
		s1, s2 := line[i], line[i + 1]
		if s1 == s2 {
			cnt++
		} else {
			arr = append(arr, cnt)
			cnt = 1
		}
	}
	arr = append(arr, cnt)
	count, mx := 0, math.MinInt32
	count = arr[0]
	for i := 1; i < len(arr); i += 2 {
		count += arr[i]
		if i + 1 < len(arr) {
			count += arr[i + 1]
		}
		if i >= 2 * k + 1 {
			count -= arr[i - (2 * k + 1)]
			count -= arr[i - (2 * k + 1) + 1]
		}
		mx = max(mx, count)
	}
	mx = max(mx, count)
	fmt.Println(mx)
}

func max(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

Measured memory_bytes: 6016
import java.util.Scanner;
import java.util.Arrays;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt(), w = sc.nextInt();
		String [][] a = new String [h][w];
		boolean [] hjudge = new boolean [h];
		boolean [] wjudge = new boolean [w];
		Arrays.fill(hjudge, false);
		Arrays.fill(wjudge, false);
		for(int i = 0; i < h; i++) {
			String x = sc.next();//配列a作成
			a[i] = x.split("");
		}

		for(int i = 0; i < h; i++) {//hjudge
			for(int k = 0; k < w; k++) {
				if(a[i][k].equals("#")) hjudge[i] = true;
			}
		}

		for(int i = 0; i < w; i++) {//wjudge
			for(int k = 0; k < h; k++) {
				if(a[k][i].equals("#")) wjudge[i] = true;
			}
		}

		for(int i = 0; i < h; i++) {//出力
			if(hjudge[i]) {
				for(int k = 0; k < w; k++) {
					if(wjudge[k]) System.out.print(a[i][k]);
				}
				System.out.println();
			}
		}

		sc.close();
	}
}


Measured memory_bytes: 27068
#include <stdio.h>

double sishagonyu(double num)	{
	
	//int num2;
	
	if(num <= 0.0004 && num >= -0.0005) return 0;
	
	if (num > 0) { num += 0.0005; }
	else { num -= 0.0005; }
	
	num = (double)(int)(num * 1000) / 1000;
	
	//	num *= 1000;
	//	num2 = (int)num;
	//	num = num2;
	//	num /= 1000;
	
	return num;
}

 
int main() {
	//x = (c1b2 - c2b1) / (a1b2 - a2b1)
	//y = (a1c2 - a2c1) / (a1b2 - a2b1)
	
	double a, b, c, d, e, f;
	double x, y;
	
	//double n, j, h, i;
	
	while(scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF){
	
		x = sishagonyu(((c * e) - (f * b)) / ((a * e) - (d * b)));
		y = sishagonyu(((a * f) - (d * c)) / ((a * e) - (d * b)));
		
		printf("%.3f %.3f\n", x, y);
	}
	
	return 0;
 }

Measured memory_bytes: 0
/*ॐ नमो भगवते वासुदेवाय नमः*/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for(int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

typedef unordered_map<int, int, custom_hash> u_map;
typedef unordered_set<int, int, custom_hash> u_set;
typedef vector<int> V;
typedef pair<int , int> pairi;
typedef set<int> seti;
typedef priority_queue<int> p_queue;
typedef deque<int> deqi;

const int MOD = 1e9+7;
const int INF = 1e9+8;
const double pi = 3.14159265359;

int binpow(int a, int b, int m) {
    a %= m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int inverse(int x){
    return binpow(x, MOD - 2, MOD);
}

void solve()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int k = max(a, b);
    int l = max(c, d);
    int m = min(a, b);
    int n = min(c, d);
    cout << max({k * l, m * n, k * n, l * m}) << endl;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}

Measured memory_bytes: 3816
#include<bits/stdc++.h>
#define N 505
using namespace std;
int n,x[N],a[N*N],cnt[N],b[N],top;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x[i]);
        a[x[i]]=i;
    }
    for(int i=1;i<=n*n;i++)if(a[i])b[++top]=a[i];
    for(int i=1;i<=n;i++)cnt[i]=i-1;
    int now=1;
    for(int i=1;i<=n*n;i++)
    {
        if(!cnt[b[now]])now++;
        if(now!=n+1&&!a[i])
        {
            a[i]=b[now];
            cnt[b[now]]--;
            if(!cnt[b[now]])now++;
        }
    }
    int flag=0;now=n;
    for(int i=1;i<=n;i++)cnt[i]=n-i;
    for(int i=n*n;i>=1;i--)
    {
        if(!cnt[b[now]])now--;
        if(!a[i])
        {
            a[i]=b[now];
            cnt[b[now]]--;
            if(!cnt[b[now]])now--;
        }
    }
    //for(int i=1;i<=n*n;i++)cout<<a[i]<<endl;
   // for(int i=1;i<=n*n;i++)cout<<a[i]<<endl;
    for(int i=1;i<=n;i++)
    {
        int cnt=0;
        for(int j=1;j<=x[i];j++)if(a[j]==i)cnt++;
        if(cnt!=i)flag=1;
    }
    if(flag)puts("No");
    else
    {
        puts("Yes");
        for(int i=1;i<=n*n;i++)
        {
            printf("%d ",a[i]);
        }puts("");
    }
    return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
 using namespace std;
 const int N=2e5+5;
 int n,num[N]; 
 int main()
 {
     cin>>n;
     for(int i=2,x;i<=n;i++)cin>>x,num[x]++;
     for(int i=1;i<=n;i++)cout<<num[i]<<endl;
     return 0;
 }

Measured memory_bytes: 4316
str_in = input()
str_len = len(str_in)
n = int(input())

for i in range(0, n):
    c = input().split()
    if (c[0] == 'print'):
        print(str_in[int(c[1]) : int(c[2]) + 1])
    elif (c[0] == 'reverse'):
        temp = ''
        for l in str_in[int(c[1]) : int(c[2]) + 1]:
            temp = l + temp
        str_in = str_in[0 : int(c[1])] + temp + str_in[int(c[2]) +1 : str_len]
    elif (c[0] == 'replace'):
        str_in = str_in[0 : int(c[1])] + c[3] + str_in[int(c[2]) +1 : str_len]



Measured memory_bytes: 5612
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c >= 22) {
    cout << "bust" << endl;
  } else {
    cout << "win" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc062_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int H, W;
  cin >> H >> W;

  vector<string> s(H);
  rep(i, H) { cin >> s[i]; }

  rep(i, H) { s[i] = '#' + s[i] + '#'; }

  string h;
  rep(i, W + 2) { h += '#'; }

  printf("%s\n", h.c_str());
  rep(i, H) { printf("%s\n", s[i].c_str()); }
  printf("%s\n", h.c_str());
}

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

#define MAX 100000

int main()
{

    int N;
    cin >> N;

    vector<int> vec(MAX);
    for(int i = 0; i < MAX; i++) vec.at(i) = 0;

    for(int i = 0; i < N; i++)
    {
        int y;
        cin >> y;
        vec.at(y)++;
    }

    int ans = 0;

    for(int i = 1; i < MAX - 1; i++)
    {
        int y = vec.at(i - 1) + vec.at(i) + vec.at(i + 1);
        ans = max(ans, y);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const double INF = 1e10;
const double pi = acos(-1);
const double eps = 1e-8;

int main(){
    double d;
    int n,b;
    cin >>d >>n >>b;

    vector<double> p(n),h(n);
    rep(i,n) cin >>p[i] >>h[i];

    double ans = INF;
    rep(num,b+1){
        double w = d/(num+1);

        auto check = [&](double theta){
            double V = sqrt(w/sin(2*theta));
            // double t = 2*V*sin(theta);
            rep(i,n){
                double pos = p[i];
                while(pos>w) pos -= w;

                double T = pos/(V*cos(theta));
                double H = -T * (T/2 - V*sin(theta));
                if(H<=h[i]) return false;
            }
            return true;
        };

        double l = pi/4, r = pi/2-eps;
        rep(loop,50){
            double m = (l+r)/2;
            if(check(m)) r = m;
            else l =m;
        }

        ans = min(ans, sqrt(w/sin(2*l)));
    }

    printf("%.10f\n", ans);
    return 0;
}



Measured memory_bytes: 3640
S = input()
L = ["AKIHABARA", "KIHABARA", "AKIHBARA", "AKIHABRA", "AKIHABAR",
     "KIHBARA", "KIHABRA", "KIHABAR", "AKIHBRA", "AKIHBAR", "AKIHABR",
     "KIHBRA", "AKIHBR", "KIHABR", "KIHBAR", "KIHBR"]
if S not in L:
  print("NO")
else:
  print("YES")

Measured memory_bytes: 2940
#include <iostream>
#include <string>
using namespace  std;
int main() {
	int a, b;
	cin >> a >> b;

	//int b;
	//cin >> b;

	int c;
	c = (a*b) % 2;

	if (c == 1) {
		cout << "Odd" << endl;

	}
	else {

		cout << "Even" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
using ll = long long;

bool compare(pair<ll, ll> a, pair<ll, ll> b) {
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}
int main() {
    // input
    ll N;
    cin >> N;

    vector<pair<ll, ll>> robots(N);

    for (size_t i = 0; i < N; i++)
    {
        ll r, dis;
        cin >> r >> dis;
        robots[i] = make_pair(r - dis, r + dis);
    }

    // sort
    sort(robots.begin(), robots.end(), compare);

    // calc
    int result = N;
    pair<ll, ll> cur = robots[0];
    for (size_t i = 1; i < N; i++) {
        pair<ll, ll> r = robots[i];
        if (cur.second <= r.first) {
            cur = r;
        } else {
            result--;
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int d;
void solve() {
    int sum = 0;
    int a = 600 / d;
    rep(i,a) {
        sum += d*i*d*i*d;
    }
    cout<<sum<<endl;
}

int main() {
    while(cin>>d) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int main(){
int a,b,c,x,s=0;
cin>>a>>b>>c>>x;
for(int i=0;i<=a&&500*i<=x;i++)
for(int j=0;j<=b&&100*j+500*i<=x;j++)
for(int k=0;k<=c&&50*k+100*j+500*i<=x;k++)
if(500*i+100*j+50*k==x) s++;
cout<<s;}

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


int main(void){
    int L, R;
    cin >> L >> R;
    int ans = 2019;
    if (R - L >= 2019 || R % 2019 <= L % 2019) {
        cout << 0 << endl;
    } else {
        for (int i = L % 2019; i < R % 2019 + 1 ; i++) {
            for (int j = i + 1; j < R % 2019 + 1; j++) {
                if ((i * j) % 2019 < ans) {
                    ans = (i * j) % 2019;
                }
            }
        
        }
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 100005
#define oo 2000000007
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n;
ll E, T, dp[maxN], minF[maxN], x[maxN];

int main () {
    cin >> n >> E >> T;
    fto(i, 1, n) cin >> x[i];
    x[n+1] = E;

    dp[0] = x[1];
    int j = 1;
    fto(i, 1, n) {
        while (2*(x[i]-x[j]) >= T) ++j;
        dp[i] = dp[j-1] + x[i+1] - x[j] + T;
        if (j > 1) dp[i] = min(dp[i], minF[j-1] + x[i+1] + 2*x[i]);
        minF[i] = min(minF[i-1], dp[i-1]-3*x[i]);
    }

    printf("%lld", dp[n]);

    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int s[10];
  int ans = 0;
  cin >> n;

  for(int i = 0;i < n;i++){
	cin >> s[i];
	ans += s[i];
  }

  sort(s, s + n);

  cout << ans - (s[n - 1] / 2) << endl;
  return 0;
}


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

using namespace std ;

const int MAX = 1e6 + 10 ;

int arr[MAX] , Plus[MAX] , Minus[MAX] ;
int n ;

bool cmp(int &i , int &j)
{
	if(Minus[i] == 0 && Minus[j] == 0)
		return Plus[i] > Plus[j] ;
	else if(Minus[i] == 0 || Minus[j] == 0) // return one the zero one
		return Minus[i] < Minus[j] ;
	else
	{
		if(Plus[i] - Minus[i] > 0 && Plus[j] - Minus[j] > 0)
			return Minus[i] < Minus[j] ;
		else if(Plus[i] - Minus[i] > 0 || Plus[j] - Minus[j] > 0)
			return Plus[i] - Minus[i] > Plus[j] - Minus[j] ;
		else
		{
			if(Plus[i] > 0 && Plus[j] > 0)
				return Plus[i] - Minus[i] > Plus[j] - Minus[j] ;
			else if(Plus[i] > 0 || Plus[j] > 0)
				return Plus[i] > Plus[j] ;
			else
				Minus[i] < Minus[j] ;
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	string s ;
	vector<int>perm ;
	for(int i = 0 ; i < n ; ++i)
	{
		cin>>s ;
		int cnt = 0 ;
		for(auto &c : s)
		{
			if(c == '(')
				cnt++ ;
			else
			{
				if(cnt == 0)
					Minus[i]++ ;
				cnt-- ;
				cnt = max(cnt , 0) ;
			}
		}
		Plus[i] = cnt ;
		perm.push_back(i) ;
	}
	sort(perm.begin() , perm.end() , cmp) ;
	int cnt = 0 ;
	for(auto &i : perm)
	{
		cnt -= Minus[i] ;
		if(cnt < 0)
			return cout<<"No\n" , 0 ;
		cnt += Plus[i] ;
	}
	if(cnt == 0)
		cout<<"Yes\n" ;
	else
		cout<<"No\n" ;
	return 0 ;
}		

Measured memory_bytes: 15120
n=int(input())
p=list(map(int,input().split()))
l=[]
for i in range(n):
  l.append(i+1)
if p[0]==1:
  print(1)
else:
  ans=0
  k=float('inf')
  for i in range(n):
    if p[i]<=k:
        k=p[i]
        ans+=1
  print(ans)

Measured memory_bytes: 26012
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static final FS sc = new FS();  // 封装输入类
    static int MAX_N = (int)1e6;
    public static void main(String[] args) {
        int k = sc.nextInt();
        if (k % 2 == 0) {
            System.out.println(-1);
            return;
        }
        int n = 7;
        for (int i = 1; i < MAX_N; i++) {
            if (n % k == 0) {
                System.out.println(i);
                return;
            }
            n = (10 * n + 7) % k;
        }
        System.out.println(-1);
    }

    static class FS {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        String next() {
            while(!st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch(Exception ignored) {}
            }
            return st.nextToken();
        }
        int[] nextArray(int n) {
            int[] a = new int[n];
            for(int i = 0;i < n;i++) {
                a[i] = nextInt();
            }
            return a;
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 32692
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    int n;
    cin >> n;
    int amin = 100, amax = -100;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
        chmin(amin, a[i]);
        chmax(amax, a[i]);
    }
    ll ans = 1LL<<60;
    for (int m = amin; m <= amax; m++) {
        ll tmp = 0;
        rep(i, n) tmp += (m - a[i]) * (m - a[i]);
        chmin(ans, tmp);
    }
    cout << ans << endl;
}

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

 int main() {
   int X,A;
   cin >> X >> A;
  // cout << X << A << endl;
   
   if(X < A){
     cout << "0" << endl;
   }else if(X >= A){
     cout << "10" << endl;
   }
}

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

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

void solve(long long X) {
  ll n = X / 200;
  cout << -n + 10 << endl;
}

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


Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define strep(it,v) for(it=v.begin();it!=v.end();++it)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b)
{
   ll res = 1;
   while(b>0)
   {
     if(b&1)
      res = (res*a)%mod;
     a = (a*a)%mod;
     b/=2;
   }
   return res;
}
#define rs resize
int main()
{
   std::ios::sync_with_stdio(false);
   ll n;
   cin>>n;
   cout<<(n%10 == n/100 ? "Yes" : "No");
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
ll Q=1000000007;

int main(){
  int N;
  cin >> N;
  vector<ll> A(N+5,0);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  ll longer=0,shorter=0;
  int i=0;
  bool ist=false;
  while(true){
    ll cur=A[i];
    if(A[i+1]==cur){
      if(ist){
        shorter=cur;
        cout << shorter*longer << endl;
        return 0;
      }
      longer=cur;
      ist=true;
      i +=2;
    }else{
      i++;
    }
  }
}

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()
#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

ll f(ll n) {
  if (n % 2) {
    return 3 * n + 1;
  } else {
    return n / 2;
  }
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll s;
  cin >> s;

  map<ll, ll> m;

  ll cnt = 1;
  m[s] = cnt++;
  for (;;) {
    s = f(s);
    if (m[s]) {
      cout << cnt << endl;
      return 0;
    } else {
      m[s] = cnt++;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define INF 10e12
#define MOD 1000000007
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;
int main(void)
{
    int n;
    cin >> n;
    int ans = 1;
    while (ans * n % 360 != 0)
        ++ans;
    cout << ans << endl;
}

Measured memory_bytes: 3548
/******************************************
* AUTHOR : GURUTEJA *
******************************************/
#include<bits/stdc++.h>
using namespace std;

void debug(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 

}

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

    int x=0,count=0;
    string s;
    unordered_map<int,int> mp;
    cin>>s;
    mp['A']=1,mp['C']=1,mp['T']=1,mp['G']=1;
    for (int i = 0; i <s.length(); ++i)
    {
    	   if(mp.find(s[i])!=mp.end()){
    	   	  count++;
    	   }else{
    	   	  x=max(x,count);
    	   	  count=0;
    	   }
    }
    x=max(x,count);
    cout<<x<<endl;

    return 0;
  }

Measured memory_bytes: 3592
#include <stdio.h>
 
int main(){
  int n, q;
  scanf("%d%d", &n, &q);
  char s[200001];
  scanf("%s", s);
  char t[200001], d[200001];
  for(int i=0; i<q; i++){
    scanf(" %c %c", &t[i], &d[i]);
  }
 
  /* 改良 */
  int count=0;
  int count2=0;
  int r=n-1;
 
  /* 呪文の実行 */
  for(int i=q-1;i>=0;i--){
    if(d[i] == 'R'){
      if (s[count-1] == t[i]) {
        count--;
      }
      if(s[r] == t[i]){
        r--;
      }
    }else if(d[i] == 'L'){
      if(s[r+1] == t[i]) {
        r++;
      }
      if(s[count] == t[i]) {
        count++;
      }
    }
  }
 
  if(r < 1){
    count2 = 0;
  }else{
    count2 = r-count+1;
  }
 
  printf("%d\n",count2);
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>

using namespace std;

int main() {
	int n, k, l[50], sum = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}
	sort(l, l + n);
	for (int i = n - 1; i >= n - k; i--) {
		sum += l[i];
	}
	cout << sum << endl;
	return 0;
}

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



int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    int xor_all = 0;
    rep(i,n){
        xor_all ^= a[i];
    }
    cout << ((xor_all == 0) ? "Yes\n" : "No\n");
}


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

int main(){
	int N,M;
	cin >> N >> M;
	int A[100];
	int B[100];
	int ans[100];
	for(int i = 0; i < 100; i++)ans[i] = 0;
	for(int i = 0; i < M; i++) cin >> A[i];
	for(int i = 0; i < M; i++){
		for(int j = 0; j < N; j++) cin >> B[j];
		int m = 0;
		for(int j = 0; j < N; j++) {
			 if(A[i] == B[j])ans[j]++;
			 else m++;
		}
		ans[A[i]-1] += m;
	}
	for(int j = 0; j < N; j++) cout << ans[j] << endl;
	return 0;
}


Measured memory_bytes: 3092
#include <iostream>

using namespace std;

int main() {
    int n1, n2, n3, n4;
    cin >> n1 >> n2 >> n3 >> n4;
    int left = n1 + n2;
    int right = n3 + n4;

    if (left > right) cout << "Left";
    else if (right > left) cout << "Right";
    else cout << "Balanced";
}   

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    int n;
    while(cin >> n){
        range(i,1,n+1){
            int x = i;
            if(x % 3 == 0) cout << " " << x;
            else{
                while(x){
                    if(x % 10 == 3){
                         cout << " " << i;
                         break;
                    }
                    x /= 10;
                }
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>

using namespace std;

int main() {
    int a,b,c;
    scanf("%d%d%d", &a, &b, &c);
    int k;
    scanf("%d", &k);
    int sum = a + b + c;
    int _max = max(max(a, b), c);
    sum -= _max;
    int time = 2;
    for(int i = 1; i < k; i++) {
        time *= 2;
    }
    sum += (_max * time);
    printf("%d", sum);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(){
double a,b,h,m,deg,pi=3.1415926535987932385;
scanf("%lf%lf%lf%lf", &a,&b,&h,&m);
 // if(6.0*m<30*h+m/2.0){}
  printf("%.10lf\n",sqrt(a*a+b*b-2*a*b*cos(2*pi/360.0*(6.0*m-30*h-m/2.0))));
return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
using ll = long long;
using namespace std;
int a[110];
int main(void)
{
    ll N, x;
    cin >> N >> x;

    for (int i = 0; i < N; ++i)
    {
        cin >> a[i];
    }
    sort(a, a + N);

    int ans = 0;
    int i = 0;
    for (i = 0; i < N; ++i)
    {
        if (x >= a[i])
        {
            x -= a[i];
            ans++;
        }
        else
        {
            break;
        }
    }
    if (ans == N && x != 0)
        ans--;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math;

void main()
{
    auto N = readln.chomp.to!int;
    auto AS = readln.split.to!(int[]);

    int[] DS1, DS2;
    DS1.length = N + 1;
    DS2.length = N;

    int sum_n;
    foreach (i; 0..N) {
        if (i == 0) {
            DS1[i] = abs(AS[i]);
            DS2[i] = abs(AS[i+1]);
        } else {
            DS1[i] = abs(AS[i-1] - AS[i]);
            DS2[i] = i == N-1 ? abs(AS[i-1]) : abs(AS[i-1] - AS[i+1]);
        }
        sum_n += DS1[i];
    }
    DS1[N] = abs(AS[N-1]);
    sum_n += DS1[N];

    foreach (i; 0..N) {
        if (i != 0) {
            sum_n -= DS2[i-1];
            sum_n += DS1[i-1] + DS1[i];
        }
        sum_n += DS2[i];
        sum_n -= (DS1[i] + DS1[i+1]);
        writeln(sum_n);
    }
}

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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll n, a, b, c, ans, x;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  cin >> n;

  cin >> a;

  for (int i = 1; i < n; i++) {
    cin >> b;
    if (b == a) continue;

    if (x) {
      if (x == 1 && b < a || x == -1 && b > a) x = 0, c++;
    } else
      x = b > a ? 1 : -1;
    a = b;
  }
  cout << c + 1 << "\n";
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int n = Integer.parseInt(sc.nextLine());
    
    int[] t = line2intAr(sc.nextLine(), n);
    int[] v = line2intAr(sc.nextLine(), n);
    
    int all = 0;
    for(int i=0; i<n; i++){
      all += t[i];
    }
    
    int[] vw = new int[all*2];
    int idx = 0;
    for(int i=0; i<n; i++){
      for(int j=0; j<t[i]*2; j++){
        vw[idx] = v[i]*2;
        idx++;
      }
    }
    
    final int VMAX = 101;
    
    int[][] dp = new int[all*2+1][VMAX*2];
    for(int i=0; i<dp.length; i++){
      for(int j=0; j<dp[i].length; j++){
        dp[i][j] = -(1<<30);
      }
    }
    dp[0][0] = 0;
    
    idx = 0;
    for(int k=0; k<n; k++){
      for(int i=0; i<t[k]*2; i++){
        for(int j=0; j<vw[idx]+1; j++){
          if(j+1 <= vw[idx] && dp[idx+1][j+1] < dp[idx][j]+j+1){
            dp[idx+1][j+1] = dp[idx][j]+ j+1;
          }
          if(j <= vw[idx] && dp[idx+1][j] < dp[idx][j]+j){
            dp[idx+1][j] = dp[idx][j]+ j;
          }
          if(j-1 <= vw[idx] && j-1 >= 0 && dp[idx+1][j-1] < dp[idx][j]+j-1){
            dp[idx+1][j-1] = dp[idx][j]+ j-1;
          }
        }
        idx++;
      }
    }
    
    System.out.println(dp[all*2][0]/4.0);
  }
  
  public static int[] line2intAr(String line, int n){
    String[] splited = line.split(" ");
    int[] ar = new int[n];
    for(int i=0; i<n; i++){
      ar[i] = Integer.parseInt(splited[i]);
    }
    return ar;
  }
}

Measured memory_bytes: 79696
N,K = map(int,input().split())
h_list = [int(input()) for _ in range(N)]
h_list_s = sorted(h_list)
min_d = 1000000000
for k in range(0,N-K+1):
  tmp = h_list_s[k+K-1] - h_list_s[k]
  if min_d > tmp:
    min_d = tmp
    
print(min_d)

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

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int k,s,res=0;
	cin>>k>>s;
	for(int i=0;i<=k;++i)
		for(int j=0;j<=k;++j)
			if(s-i-j>=0&&s-i-j<=k) res++;
	cout<<res<<'\n';
}




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

void dfs(int i, vector<set<int>> &G, set<int> &S){
    S.erase(i);
    for(auto p: G.at(i)){
        if(S.count(p)){
            dfs(p, G, S);
        }
    }
}

int main(){
    int n,m;
    cin >> n >> m;
    vector<set<int>> G(n);
    vector<int> A(m),B(m);
    for(int i=0; i<m; i++){
        int a,b;
        cin >> a >> b;
        a--;b--;
        A.at(i)=a;
        B.at(i)=b;
        G.at(a).insert(b);
        G.at(b).insert(a);
    }
    int ans=0;
    for(int i=0; i<m; i++){
        set<int> S;
        for(int i=0; i<n; i++){
            S.insert(i);
        }
        int a=A.at(i);
        int b=B.at(i);
        G.at(a).erase(b);
        G.at(b).erase(a);
        dfs(0, G, S);
        if(!S.empty()) ans++;
        G.at(a).insert(b);
        G.at(b).insert(a);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n1 = sc.nextInt();
    int four = 4;
    int seven = 7;
    int a = n1;
    
    if(n1%four==0 || n1%seven==0){
      System.out.println("Yes");
      return;
    }
    
    while(n1 > 0){
      n1 -= seven;
      if(n1 > 0 && n1 % four == 0){
        System.out.println("Yes");
        return;
      }
    }
    
    while(a > 0){
      a -= four;
      if(n1 > 0 && n1 % seven == 0){
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }
}


Measured memory_bytes: 22868
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<queue>
#include<utility>
#include<cstdio>
#include<cstring>
#include<new>
#include<float.h>
#include<ctype.h>
#include<cfloat>
#include<cmath>
#include<cctype>
#include<errno.h>
#include<cerrno>
#include<memory>
#include<memory.h>
#include<assert.h>
#include<cassert>
#include<deque>
#include<sstream>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qui queue<int>
#define vit vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define prq priority_queue
#define pii pair<int,int>
#define mp make_pair
#define sz size()
#define em empty()
#define ct continue
#define ms multiset
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define ppf pop_front()
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
int a[101010],n,k,ans=1e9;
int main()
{
	cin>>n>>k;
	fo(i,0,n)cin>>a[i];
	if(k==1){
		fo(i,0,n)ans=min(ans,abs(a[i]));
		cout<<ans<<endl;
		return 0;
	}
	fo(i,0,n-k+1){
		if(a[i]<=0&&a[i+k-1]>=0)ans=min(ans,min(abs(a[i]),abs(a[i+k-1]))*2+max(abs(a[i]),abs(a[i+k-1])));
		else if(a[i]<=0)ans=min(ans,abs(a[i]));
		else ans=min(ans,a[i+k-1]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
const int maxn =2e5+9;
int a[maxn];
int fa[maxn];
int fi(int x){
    if(fa[x]== x) return x;
    return fa[x] = fi(fa[x]);
}
void uniun(int u,int v){
    int fu = fi(u);
    int fv = fi(v);
    if(fu!=fv){
        fa[fu] = fv;
    }
}
int main()
{
   // string nn = "1234366";
   // cout<<nn.substr(1,2);

    int n,m;
    while(~scanf("%d%d",&n,&m)){
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            fa[i] = i;
        }
        for(int i=1;i<=m;i++){
            int u,v;
            scanf("%d%d",&u,&v);
            uniun(u,v);
        }
        int cnt = 0;
        for(int i=1;i<=n;i++){
            int tmp = a[i];
            if(fi(a[i])==fi(i)){
                cnt++;
            }
        }
        printf("%d\n",cnt);
    }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int n,st[N],f[N];
vector<int> E[N];
void dfs(int u) {
    if(E[u].empty()) return;
    for(int v:E[u]) dfs(v);
    int top=0;
    for(int v:E[u]) st[++top]=f[v];
    sort(st+1,st+top+1,greater<int>());
    for(int i=1;i<=top;i++) f[u]=max(f[u],st[i]+i);
}
int main() {
    cin>>n;
    for(int i=2;i<=n;i++) E[gi()].push_back(i);
    dfs(1);printf("%d\n",f[1]);
    return 0;
}
//orzgzy
//鸡贼明年进队超稳


Measured memory_bytes: 10752
l = input().split()
a = int(l[0])
b = int(l[2])
op = l[1]
while op != "?":
    if op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)
    l = input().split()
    a = int(l[0])
    b = int(l[2])
    op = l[1]


Measured memory_bytes: 5596
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
int n,a[3001];
int main()
{
	cin>>n;
	int sum=0;
	for(int i=1;i<=n;i++) 
	{
		cin>>a[i];
		sum+=a[i];
	}
	cout<<sum-n<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cstdlib>
#include <utility>
#include <cmath>
#include <queue>
#include <stack>
#include <cstring>

using namespace std;

#define ll long long

#ifndef ONLINE_JUDGE
#define debug(format, ...) fprintf(stderr, \
    "%s:%d: " format "\n", __func__, __LINE__,##__VA_ARGS__)
#else
#define debug(format, ...)
#define NDEBUG
#endif

vector<int> graph[200005];

ll ans = 0;

int main()
{
    int n; scanf("%d", &n);
    for (int i = 1; i < n; i++) {
        int u, v; scanf("%d%d", &u, &v);
        graph[u].push_back(v);
        graph[v].push_back(u);
    }

    for (int i = 1; i <= n; i++) {
        ans += (ll)i * (ll)(n - i + 1);
        for (int j = 0; j < graph[i].size(); j++) {
            if (graph[i][j] > i) continue;
            ans -= (ll)(graph[i][j]) * (ll)(n - i + 1);
        }
    }
    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 14544
N = int(input())
B = list(map(int,input().split()))
A =[0 for _ in range(N)]
A[0]=B[0]
for i in range(1,N):
    if i==N-1:
        A[i]=B[i-1]
    else:
        A[i]=min(B[i-1],B[i])
print(sum(A))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>

using namespace std;

const int MOD = 1000000007;

template<typename T>
class RangeAddQuery {
public:
    explicit RangeAddQuery(int n) : N(calcN_(n)) {
        mVal.assign(2*N+1, 0);
    }
    void update(int l, int r, T value){
        l = max(0, l);
        r = min(N, r);
        int offset = N;
        while(offset > 0){
            if(l >= r) break;
            if(l&1){ update_(mVal[offset+l-1], value); l++; }
            if(r&1){ update_(mVal[offset+r-2], value); }
            l /= 2;
            r /= 2;
            offset /= 2;
        }
    }
    T get(int idx){
        int i = N + idx - 1;
        auto res = mVal[i];
        while(i > 0){
            i = (i-1)/2;
            update_(res, mVal[i]);
        }
        return res;
    }
private:
    int calcN_(int n){
        int res = 1;
        while(res < n) res *= 2;
        return res;
    }
    inline void update_(T& data, T val) { data = (data + val) % MOD; }
    const int N;
    vector<T> mVal;
};

int maxSegment(const string& S){
    char c = S[0];
    bool first = true;
    int cnt = 0;
    int res = MOD;
    for(auto& s : S){
        if(c == s) ++cnt;
        else {
            if(first || cnt%2 == 1){
                res = min(res, cnt/2+1);
                first = false;
            }
            cnt = 0;
        }
    }
    return res < MOD ? res : -1;
}

int solve(const string& S, int N){
    int seg = maxSegment(S);
    if(seg != -1 && N%2 == 1) return 0;
    long long res = 0;
    if(seg == -1){
        RangeAddQuery<long long> raq(N);
        raq.update(0, 1, 1);
        for(int i=0;i<N;i++){
            auto a = raq.get(i);
            raq.update(i+2, N, a);
        }
        res = 1;
        for(int i=N-2;i>=0;i--){
            res = (res + raq.get(i) * (N-i)) % MOD;
        }
    } else {
        seg = min(seg, N/2);
        RangeAddQuery<long long> raq(N/2);
        raq.update(0, 1, 1);
        for(int i=0;i<N/2;i++){
            auto a = raq.get(i);
            raq.update(i+1, i+1+seg, a);
        }
        for(int i=N/2-1;i>=N/2-seg;i--){
            res = (res + raq.get(i) * 2 * (N/2-i)) % MOD;
        }
    }
    return res;
}

int main(){
    int N, M; cin >> N >> M;
    string S; cin >> S;
    cout << solve(S, N) << endl;
}


Measured memory_bytes: 4612