akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define db long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define pii pair<int , int>
#define pdd pair<double , double>
#define pll pair<long long int,long long int>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.000001
#define stp setprecision(20)
#define endl '\n'
int main()
{  
    fastio;
    /*
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
    */
    ll n,m;cin>>n>>m;
    char a[n][m];
    for(ll i=0;i<n;i++)
    	for(ll j=0;j<m;j++)
    		cin>>a[i][j];
    for(ll i=0;i<n;i++)
    {
    	bool bb=0;
    	for(ll j=0;j<m;j++)
    		if(a[i][j]=='#')
    			bb=1;
    	if(!bb)
    	{
    		for(ll j=0;j<m;j++)
    			a[i][j]='*';
    	}
    }
    for(ll j=0;j<m;j++)
    {
    	bool bb=0;
    	for(ll i=0;i<n;i++)
    		if(a[i][j]=='#')
    			bb=1;
    	if(!bb)
    	{
    		for(ll i=0;i<n;i++)
    			a[i][j]='*';
    	}
    }
    vector<char > v[n];
    for(ll i=0;i<n;i++)
    {
    	for(ll j=0;j<m;j++)
    		if(a[i][j]!='*')
    			v[i].pb(a[i][j]);
    }
    for(ll i=0;i<n;i++)
    {
    	if(v[i].size()==0)
    		continue;
    	for(ll j=0;j<v[i].size();j++)
    		cout<<v[i][j];
    	cout<<endl;
    }
} 



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    A=list(map(int,input().split()))
    for x in A:
        if x%2==0 and (x%3!=0 and x%5!=0):
            print('DENIED')
            exit()
    print('APPROVED')
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 38736
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8

static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;

int t;

int main(){
	int *prime;
	prime = (int *)malloc(1000010*sizeof(t));
	if(prime==NULL) cout<<"no mem\n";
	rep(i,1000010){
		prime[i]=true;
	}
	prime[0]=prime[1]=false;
	for(int i=2;i*i<1000010;i++){
		if(prime[i]){
			for(int j=i*i;j<1000010;j+=i){
				prime[j]=false;
			}
		}
	}
	
	int *sum;
	int num=0;
	sum=(int *)malloc(1000010*sizeof(t));
	if(sum==NULL) cout<<"no mem\n";
	rep(i,1000010){
		if(prime[i]){
			num++;
		}
		sum[i]=num;
	}
	int n;
	while(cin>>n){
		cout<<sum[n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 8996
import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	int a,b,c,d,e,f,k,l,m,n,x,y,z;
	int ans;
	int[] h;
	boolean flg=true;
	String[] S;

	Main(){
		n = sc.nextInt();
		h = new int[n];
		for(int i=0;i<n;i++)
			h[i]=sc.nextInt();

		for(int j=n-1;j>0;j--){
			if(h[j]<h[j-1]){
				if(h[j-1]-h[j]==1){
					h[j-1]-=1;
				} else {
					flg=false;
					break;
				}
			}
		}

		// 出力
		if(flg)
			System.out.println("Yes");
		else
			System.out.println("No");
	}

	public static void main(String[] args){
		new Main();
	}
}

Measured memory_bytes: 52308
import java.util.*;

public class Main {
        public static void main(String[] args) {
                try(Scanner sc = new Scanner(System.in)) {
                        int N = sc.nextInt();
                        long[] A = new long[N * 3];
                        for(int i = 0; i < N * 3; i++) {
                                A[i] = sc.nextLong();
                        }
                        Arrays.sort(A);
                        long ans = 0;
                        for(int i = 0; i < 2 * N; i += 2) {
                                ans += A[N * 3 - i - 2];
                        }
                        System.out.println(ans);
                }
        }
}


Measured memory_bytes: 98264
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define RREP(i, a, n) for(int i=n-1; i>=a; i--)

int th90[2][2] = { {0, -1}, {1, 0} };
int main() {
	int n;
	while (cin >> n, n) {
		vector<pair<int, int>> origin;
		int m, y[11], x[11];
		cin >> m;
		REP(i, 0, m) cin >> x[i] >> y[i];
		REP(i, 0, m - 1) {
			origin.emplace_back(y[i + 1] - y[i], x[i + 1] - x[i]);
		}

		REP(i, 0, n) {
			vector<pair<int, int>> tmp;
			cin >> m;
			REP(j, 0, m) cin >> x[j] >> y[j];
			REP(j, 0, m - 1) {
				tmp.emplace_back(y[j + 1] - y[j], x[j + 1] - x[j]);
			}

			if (origin.size() != tmp.size()) continue;
			
			bool match = false;
			REP(j, 0, 4) {
				bool flag = true;

				REP(k, 0, origin.size()) {
					int yy = tmp[k].first, xx = tmp[k].second;
					REP(l, 0, j) {
						int yyy = yy, xxx = xx;
						xx = th90[0][0] * xxx + th90[0][1] * yyy;
						yy = th90[1][0] * xxx + th90[1][1] * yyy;
					}

					if (origin[k].first != yy || origin[k].second != xx) {
						flag = false;
						break;
					}
				}

				if (flag) {
					match = true;
					break;
				}
			}

			if (match) {
				cout << i + 1 << endl;
				continue;
			}

			match = false;
			REP(j, 0, 4) {
				bool flag = true;

				RREP(k, 0, origin.size()) {
					int yy = tmp[k].first, xx = tmp[k].second;
					REP(l, 0, j) {
						int yyy = yy, xxx = xx;
						xx = th90[0][0] * xxx + th90[0][1] * yyy;
						yy = th90[1][0] * xxx + th90[1][1] * yyy;
					}

					if (origin[origin.size() - 1 - k].first != yy || origin[origin.size() - 1 - k].second != xx) {
						flag = false;
						break;
					}
				}

				if (flag) {
					match = true;
					break;
				}
			}

			if (match) cout << i + 1 << endl;
		}

		cout << "+++++" << endl;
	}
	return 0;
}

Measured memory_bytes: 3020
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define pb push_back
#define pii pair<long long,long long>
#define endl '\n'
#define N 300001
void solve()
{
    double pi = acos(-1);
    double a,b,hh,mm,h,m; cin>>a>>b>>hh>>mm;
    h=((double)60*hh+mm)*.5;
    m=mm*6;
    double ang =(abs(h-m));
    cout<<fixed<<setprecision(20)<<sqrt(a*a+b*b-2*b*a*cos(ang*pi/(double)180))<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test; test=1; //cin>>test;
    int x=1;
    while(test--)
    {
        //cout<<"Case #"<<x++<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 4292
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll n;
	cin>>n;
	vector<ll> a(n);
	rep(i, n) cin>>a[i];
	reverse(all(a));
	bool ng = false;
	if(a[0]!=2){
		ng = true;
	}
	ll mn = 2, mx = 2;
	for(int i = 0; i < n; i++){
		ll mn2 = (mn+a[i]-1)/a[i]*a[i], mx2 = mx/a[i]*a[i]+(a[i]-1);
		ll mn3 = mn2/a[i]*a[i], mx3 = mx/a[i]*a[i];
		if(mn3<mn||mx3<mn||mn3>mx||mx3>mx||mn3>mx3) ng = true;
		mn = mn2;
		mx = mx2;
		//cerr<<mn<<" "<<mx<<endl;
	}
	if(ng) cout<<-1<<endl;
	else cout<<mn<<" "<<mx<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
using namespace std;
using Graph = vector<vector<int>>;

signed main(){
 string A;
  cin >> A;
  
  if( A.at(0) == A.at(1)&& A.at(1) == A.at(2) ) cout << "No" << endl;
  else cout << "Yes" << endl;
  
}

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

int32_t main(){
	int n; cin>>n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i){
		cin>>a[i];
	}
	sort(a.begin(), a.end());
	int ans = a[int(a.size()) - 1] / 2;
	for(int i = 0; i + 1 < int(a.size()); i++){
		ans += a[i];
	}
	cout<<ans<<endl;
}


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

int n,x;
int b[111111],l[111111],u[111111];
long long m;
struct P{
    long long x,y;
};
P o[111111];

bool as(P a,P b)
{
    return a.x>b.x;
}

bool f(long long a)
{
    long long t=0,t2=0;
    for(int t=1;t<=n;t++)
        o[t]={(long long)(x-b[t])*u[t]+(long long)b[t]*l[t],t};
    sort(o+1,o+n+1,as);
    for(int i=1;i<=a/x+1;i++)
    {
        if(i<a/x+1)
        t+=o[i].x;
        t2+=o[i].x;
    }
    if(t+m>=0) return 1;
    for(int i=1;i<=a/x+1;i++)
    {
        long long z=t2-o[i].x+max((long long)(a%x-b[o[i].y])*l[o[i].y],(long long)(a%x-b[o[i].y])*u[o[i].y])+(long long)b[o[i].y]*l[o[i].y];
        if(z+m>=0) return 1;
    }
    for(int i=a/x+2;i<=n;i++)
    {
        long long z=t+max((long long)(a%x-b[o[i].y])*l[o[i].y],(long long)(a%x-b[o[i].y])*u[o[i].y])+(long long)b[o[i].y]*l[o[i].y];
        if(z+m>=0) return 1;
    }
    return 0;
}

int main()
{
	scanf("%d %d",&n,&x);
	for(int i=1;i<=n;i++)
    {
        scanf("%d %d %d",&b[i],&l[i],&u[i]);
        m-=(long long)b[i]*l[i];
    }
    long long a=0,b=(long long)x*n;
    for(;a<b;)
    {
        long long h=(a+b)/2;
        if(f(h)) b=h;
        else a=h+1;
    }
    printf("%lld",a);
}


Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <cmath>
#include <string>
#include <stdlib.h>
#include <fstream>
using namespace std;


int main() {
	int h, w, n;
	cin >> h >> w >>n;
	cout << (n % max(w, h) == 0? n / max(w, h): n / max(w, h) + 1);
	
}

Measured memory_bytes: 632
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N; cin >> N;
	int h[100001], dp[100001];
	for (int i = 0; i < N; i++) cin >> h[i];
	dp[0] = 0, dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < N; i++) 
		dp[i] = min(dp[i - 2] + abs(h[i] - h[i-2]), dp[i - 1] + abs(h[i] - h[i-1]));
	cout << dp[N - 1] << '\n';
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  vector<string> vec(110);
  for (int i = 0; i < a; i++) cin >> vec.at(i);
  for (int i = 0; i < b + 2; i++) cout << "#";
  cout << endl;
  for (int i = 0; i < a; i++) {
    cout << "#" << vec.at(i) << "#" << endl;
  }
  for (int i = 0; i < b + 2; i++) cout << "#";
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(int argc, char **argv)
{
    int N;
    cin >> N;
    int H[N];
    REP(i, N) cin >> H[i];

    int m = -1;
    int c = 0;
    REP(i, N - 1) {
        if (H[i] >= H[i + 1]) c++;
        else {
            if (c > m) m = c;
            c = 0;
        }
    }
    if (c > m) m = c;
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  ll n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  ll cnt=0;
  rep(i,n){
    for(int j=i; j<n; j++){
      if(a[i]>a[j]) cnt++;
    }
  }
  ll ans=(k*cnt)%MOD;
  cnt=0;
  rep(i,n)rep(j,n){
    if(a[i]>a[j]) cnt++;
  }
  ans+=(k-1)*k/2%MOD*cnt%MOD;
  cout << ans%MOD << endl;
  return 0;
}


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

using namespace std;

#define debug printf("Debug\n");
#define ll long long
#define ull unsigned long long

#define pi acos(-1.0)
#define mod 1000000007

#define p_b(x) push_back(x)
#define m_p(x) make_pair(x,y)

#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define in_fre  freopen("in.txt", "r", stdin);
#define out_fre freopen("out.txt", "w", stdout);

struct Node{
    ll val,pos;
};
vector<ll>v;

ll a[200005];

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

    for(ll i=1;i<=n;i++) cin>>a[i];

    ll ans=1;
    ll mini=a[1];

    for(ll i=2;i<=n;i++){
        ll x;
        x=a[i];
        if(x<=mini){
            ans++;
            mini=x;
        }
    }

    cout<<ans<<endl;



    return 0;
}


Measured memory_bytes: 1792
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define		vii 			vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
#define     test(i)        cout<<i<<endl
int dx[] = {-1 , 1 , 0 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 0 , 1 ,-1 ,-1 , 1 ,-1 , 1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
const int mxN=2e5+5,oo=0x3f3f3f3f,mod=1e9+7;
int n,k;
int arr[mxN],dp[mxN];
int go(int idx){
    if(idx==n-1)
        return 0;
    int &ret=dp[idx];
    if(~ret)
        return ret;
    int cnt=1;
    ret=1e9;
    while(cnt<=k&&idx+cnt<n){
        ret=min(ret,go(idx+cnt)+abs(arr[idx]-arr[idx+cnt]));
        cnt++;
    }
    return ret;
}
void solve(){
    cin>>n>>k;
    loop(n,i,0)
        cin>>arr[i];
    mem(dp,-1);
    cout<<go(0)<<endl;
}
int main() {
    fast();
    solve();
}

Measured memory_bytes: 4608
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>

#define ll long long
using namespace std;
static ll imin = std::numeric_limits<ll>::min();
static ll imax = std::numeric_limits<ll>::max();
#define rep(i, n) for(int i = 0; i<n; ++i)
#define rep1(i, n) for(int i = 1; i<n; ++i)
#define debug(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  for(int i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}

int main(int const argc, char const** argv){
  ll N, A, B;
  cin >> N >> A >> B;
  
  vector<ll> v(N);
  rep(i, N){
    cin >> v[i];
  }
  sort(all(v));
  ll ac = 0, bc = 0, cc = 0;
  rep(i, N){
    // debug(v[i]);
    if(v[i] <= A){
      ac++;
    }else if(v[i] <= B){
      bc++;
    }else{
      cc++;
    }
  }
  // debug(ac);
  // debug(bc);
  // debug(cc);
  cout << min(min(ac, bc), cc);
}



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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin >>  s;
	int m=0;
	int c=0;
	for(int i=0;i<s.length();i++){
        if (s[i]=='R'){
            c++;
        }
        else if (s[i]!='R'){
            m=max(m,c);
            c=0;
        }
        if (s[i]=='R' && i==s.length()-1) {m=max(m,c);}
	}

	cout << m;
	return 0;
}


Measured memory_bytes: 3648
import java.util.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] a = new int[3*N];
        for(int i = 0; i < 3*N; i++){
            a[i] = sc.nextInt();
        }
        sc.close();
        Arrays.sort(a);
        long sum = 0;

        for(int i = 3*N-2; i>=N; i = i-2){
            sum += a[i];
        }

        System.out.println(sum);
    }
}

Measured memory_bytes: 92300
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<cstdio>
#include<cstring>
#include<math.h>
#include<algorithm>
using namespace std;
#define ll long long
int a[100010];
int main()
{
     int i,j,k,n,m,x,y,z;
     x=y=z=0;
     scanf("%d",&n);
     for(i=0;i<n;i++)
     {
          scanf("%d",&a[i]);
          if(a[i]%4==0)
          x++;
          else
          {
               if(a[i]%2==0)
                    y++;
               else
                    z++;
          }
     }
     if(y>0)
     {
          if(x>=z)
               printf("Yes\n");
          else
               printf("No\n");
     }
     else
     {
          if(x+1>=z)
               printf("Yes\n");
          else
               printf("No\n");
     }
     return 0;
}


Measured memory_bytes: 640
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);

        String s = stdIn.nextLine();
        int count = 0;

        for (int i = 0; i < 3; i++)
            if (s.charAt(i) == '1') {
                count++;
            }

        System.out.println(count);
    }
}

Measured memory_bytes: 24148
#include<set>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int Maxn=2*1e5;

char s[Maxn+5],t[Maxn+5];
int c[256+5];

int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%s %s",s,t);
	int len=strlen(s);
	memset(c,-1,sizeof c);
	set<char> cnt;
	for(int i=0;i<len;i++)
		cnt.insert(s[i]);
	for(int i=0;i<len;i++) {
		if(c[t[i]]!=-1&&c[t[i]]!=s[i]) {
			if(t[i]==s[i]&&cnt.size()<26)
				continue;
			puts("No");
			return 0;
		}
		c[t[i]]=s[i];
	}
	memset(c,-1,sizeof c);
	for(int i=0;i<len;i++) {
		if(c[s[i]]!=-1&&c[s[i]]!=t[i]) {
			if(t[i]==s[i]&&cnt.size()<26)
				continue;
			puts("No");
			return 0;
		}
		c[s[i]]=t[i];
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 640
n = int(input())

h_list = [int(h) for h in input().split()]

dp = [0] * n
dp[0], dp[1] = 0, abs(h_list[1] - h_list[0])

for i in range(2, n):
    dp[i] = min(dp[i-1] + abs(h_list[i] - h_list[i-1]),
                dp[i-2] + abs(h_list[i] - h_list[i-2]))

print(dp[n-1])


Measured memory_bytes: 13980
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        long a = scan.nextLong();
        long b = scan.nextLong();
        long c = scan.nextLong();
        scan.close();
        long d = c - (a + b);

        if(d <= 2) System.out.println("No");
        else if(4 * a * b < (d * d)) System.out.println("Yes");
        else System.out.println("No");
    }
}

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

int count_digits(ll N){
    int digits = 0;
    while(N > 0){
        N /= 10;
        digits++;
    }
    return digits;
}

int main(){
    ll N;
    cin >> N;
    
    int ans = count_digits(N);
    ll B;
    int cur;

    for(ll A=1LL;A*A<=N;A++){
        if(N%A != 0)    //AがNの約数でないならスキップ
            continue;
        B = N/A;
        cur = max(count_digits(A), count_digits(B));
        if(ans > cur)
            ans = cur;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
public class AddAndSubEasy
{
    public static void Main()
    {
        string[] sepLine = System.Console.ReadLine().Split(' ');
        if(sepLine[1] == "+")
        {
            System.Console.WriteLine(int.Parse(sepLine[0]) + int.Parse(sepLine[2]));
        }
        else
        {
            System.Console.WriteLine(int.Parse(sepLine[0]) - int.Parse(sepLine[2]));
        }
    }
}

Measured memory_bytes: 2776
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<cmath>
using namespace std;
using Graph = vector<vector<int>>;
typedef unsigned long long ll;
ll mod = (10e+8)+ 7;

#define For(N,i) for(int i = 0; i < N; i++)


int main(){
	ll N;
	cin>>N;
	ll roots = 10e+12 + 7;
	
	
	for(ll i = 1; i <= sqrt(N); i++){
		
		if(N % i == 0){
			ll j = N / i;
			if((i - 1) + ( j - 1 ) < roots){
				roots = (i - 1) + ( j - 1 );
			}
		}
	}
		cout<<roots<<endl;
}

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

using ll = long long;

int n;

int in (int v) {
	if (v == 0) return n;
	if (v == n+1) return 1;
	if (v == -1) return n-1;
	if (v == n+2) return 2;
	return v;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n;
	vector <int> a(n+1), b(n+1);
	for (int i=1; i<=n; i++) {
		cin >> a[i];
	}
	for (int i=1; i<=n; i++) {
		cin >> b[i];
	}
	priority_queue <pair<int, int>> bfs;
	for (int i=1; i<=n; i++) {
		if (b[i] > b[in(i-1)]+b[in(i+1)] && b[i] > a[i]) {
			bfs.push({b[i], i});
		}
	}
	ll ans = 0;
	while (!bfs.empty()) {
		int v = bfs.top().second;
		bfs.pop();
		int cnt = (b[v]-a[v])/(b[in(v-1)]+b[in(v+1)]);
		ans += cnt;
		b[v] -= cnt*(b[in(v-1)]+b[in(v+1)]);
		if (b[in(v-1)] > b[in(v-2)]+b[v] && b[in(v-1)] > a[in(v-1)]) {
			bfs.push({b[in(v-1)], in(v-1)});
		}
		if (b[in(v+1)] > b[in(v+2)]+b[v] && b[in(v+1)] > a[in(v+1)]) {
			bfs.push({b[in(v+1)], in(v+1)});
		}
	}
	for (int i=1; i<=n; i++) {
		if (b[i] != a[i]) {
			cout << -1;
			return 0;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3064
num_Coin500 = int(input())
num_Coin100 = int(input())
num_Coin50 = int(input())
total = int(input())

count = 0

for i_Coin500 in range(num_Coin500 + 1):
    for i_Coin100 in range(num_Coin100 + 1):
        for i_Coin50 in range(num_Coin50 + 1):
            sum = 500*i_Coin500 + 100*i_Coin100 + 50*i_Coin50
            if total == sum:
                count += 1

print(count)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
// constexpr int mod = 1000000007;
constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    ll a;
    string s;
    cin >> a >> s;
    int mul = 100;
    int b = 0;
    for(int i = 0; i < s.length(); ++i){
        if(s[i] == '.') continue;
        b += (s[i] - '0') * mul;
        mul /= 10;
    }
    ll ans = a * b / 100;
    cout << ans << endl;
}

Measured memory_bytes: 3652
import java.io.InputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());

    Edges edgesArray[] = new Edges[n + 1];
    Queue<Node> bfsQueue = new LinkedList<>();
    Map<Integer, Node> nodeMap = new HashMap<>();
    for (int i = 1; i <= n; i++) {
      nodeMap.put(i, new Node(i));
      edgesArray[i] = new Edges(i);
    }
    for (int i = 0; i < m; i++) {
      int a = Integer.parseInt(sc.next());
      int b = Integer.parseInt(sc.next());
      Edge edge = new Edge(a, b);
      Edge inv = new Edge(b, a);
      edgesArray[edge.from].add(edge);
      edgesArray[inv.from].add(inv);
    }
    bfsQueue.add(nodeMap.get(1));
    while (!bfsQueue.isEmpty()) {
      Node node = bfsQueue.poll();
      Edges edges = edgesArray[node.n];
      for (Edge edge : edges.edges) {
        Node to = nodeMap.get(edge.to);
        if (to.next > 0) {
          continue; // already visited
        }
        to.next = node.n;
        bfsQueue.add(to);
      }
    }
    nodeMap.remove(1);
    if (nodeMap.values().stream().mapToInt(node -> node.next).allMatch(i -> i > 0)) {
      pw.println("Yes");
      for (int i = 2; i <= n; i++) {
        pw.println(nodeMap.get(i).next);
      }
    } else {
      pw.println("No");
    }
  }

  static class Node {

    int n;
    int next = -1;

    public Node(int n) {
      this.n = n;
    }
  }

  static class Edges {

    int from;
    private List<Edge> edges = new ArrayList<>();

    public Edges(int from) {
      this.from = from;
    }

    private void add(Edge edge) {
      edges.add(edge);
    }
  }

  static class Edge {

    int from;
    int to;

    private Edge(int from, int to) {
      this.from = from;
      this.to = to;
    }
  }
}


Measured memory_bytes: 92268
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];
    sort(a.rbegin(), a.rend());

    double ans = (a[2] + a[3]) / (double)(a[0] - a[1]);
    ans = max(ans, (a[0] + a[3]) / (double)(a[1] - a[2]));
    for(int i=2; i<n-1; ++i)
        ans = max(ans, (a[0] + a[1]) / (double)(a[i] - a[i+1]));
    printf("%.10f\n", ans);

    return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
    string S; cin >> S;
    Int ans = 0;
    int cnt = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'B') {
            cnt++;
        } else {
            ans += cnt;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
void func(int,int,int);
int n,m,ice[90][90],cnt;
int main(void)
{
	int i,k;
	while(1){
		scanf("%d %d",&m,&n);
		if(m==0&&n==0) break;
		for(i=0;i<n;i++){
			for(k=0;k<m;k++) scanf("%d",&ice[i][k]);
		}
		cnt=0;
		for(i=0;i<n;i++){
			for(k=0;k<m;k++){
				if(ice[i][k]==1){
					func(i,k,0);
				}
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}
	
void func(int y,int x,int c)
{
	int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0},i,k,xx,yy;
	for(i=0;i<4;i++){	
		xx=x+dx[i]; yy=y+dy[i];
		if(xx<m&&xx>=0&&yy<n&&yy>=0&&ice[yy][xx]!=0){

			ice[yy][xx]=0; func(yy,xx,c+1); ice[yy][xx]=1;
		}
	}
	if(cnt<c) cnt=c;
}


Measured memory_bytes: 2700
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        double ans = 0;
        int result = Integer.parseInt(a + b);
        ans = Math.sqrt(result);
        int re = (int) ans;
        if (ans == re) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

}

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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, A, B, C, D; cin >> N >> A >> B >> C >> D;
	string S; cin >> S;
	A--, B--, C--, D--;

	auto is_good = [&](int l, int r) -> bool {
		for (int i = l; i <= r-1; i++) {
			if (S[i] == '#' && S[i+1] == '#') {
				return false;
			}
		}
		return true;
	};

	auto is_good2 = [&](int l, int r) -> bool {
		int cnt = 0;
		for (int i = l; i <= r; i++) {
			if (S[i] == '.') {
				cnt++;
				if (cnt >= 3) {
					return true;
				}
			} else {
				cnt = 0;
			}
		}
		return false;
	};

	bool ans;
	if (C > D) {
		ans = is_good(A, C) && is_good2(B-1, D+1);
	} else {
		ans = is_good(A, C) && is_good(B, D);
	}

	if (ans) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 592
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define PDD pair<double, double>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;

}

LL exp(LL a, LL b){
    LL res = 1;
    LL sum = a;
    while(b){
        if(b&1)res = (res * sum);
        sum = (sum * sum);
        b>>=1;
    }
    return res;
}

double exp(double a, LL b){
    double res = 1;
    double sum = a;
    while(b){
        if(b&1)res = (res * sum);
        sum = (sum * sum);
        b>>=1;
    }
    return res;
}

signed  main(){
    int A, B;
    cin >> A >> B;
    cout << (A>=B*2-1?"YES":"NO") << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;

class Main
{
	public static void main ( String[] args )
	{
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), A = sc.nextInt();
		ArrayList<Integer> x = new ArrayList<Integer>();

		for( int i = 0; i < N; ++i ) x.add(sc.nextInt());

		long[][][] dp = new long[51][51][50*50+10];

		for( int i = 0; i < 51; ++i ){
			for( int j = 0; j < 51; ++j ){
				for( int k = 0; k < 50*50+10; ++k ){
					dp[i][j][k] = -1;
				}
			}
		}

		for( int i = 0; i < N+1; ++i ) dp[i][0][0] = 0;
		for( int i = 0; i < N; ++i ) dp[i+1][1][x.get(i)] = 1;
		for( int i = 1; i < N; ++i ){
			for( int j = 0; j < N; ++j ){
				for( int k = 0; k < 50*50+10; ++k ){
					if( dp[i][j][k] != -1 ){
						if( dp[i+1][j][k] == -1 ) dp[i+1][j][k] = 0;
						dp[i+1][j][k] += dp[i][j][k];

						if( k + x.get(i) < 50*50+10 ){
							if( dp[i+1][j+1][k+x.get(i)] == -1 ) dp[i+1][j+1][k+x.get(i)] = 0;
							dp[i+1][j+1][k+x.get(i)] += dp[i][j][k];
						}
					}
				}
			}
		}

		long ans = 0;
		for( int i = 1; i < N+1; ++i )
			for( int j = 0; j < 50*50+10; ++j )
				if( j % i == 0 && j / i == A && dp[N][i][j] != -1 ) ans += dp[N][i][j];
		System.out.println(ans);
	}
}


Measured memory_bytes: 66244
#include <iostream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <cmath>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c,n,i;
    cin>>n;
    
    for(i=0;i<n;i++){
        cin>>a>>b>>c;
                if(a*a==b*b+c*c || b*b==a*a+c*c || c*c==b*b+a*a)
            cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        
    }
        
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    int C[N],V[N];
    int cnt = 0;
    for(int i = 0; i < N; i++)
    {
        cin >> V[i];
    }
    for(int i = 0; i < N; i++)
    {
        cin >> C[i];
    }

    for(int i = 0; i < N; i++)
    {
        if(V[i] - C[i] > 0)
        {
            cnt += V[i] - C[i];
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
int n,a,b;
long long v[50];
long long c[51][51];
void comb(int N){
    for(int i=0;i<=N;i++){
        for(int j=0;j<=i;j++){
            if(j==0||j==i){
                c[i][j]=1LL;
            }else{
                c[i][j]=(c[i-1][j-1]+c[i-1][j]);
            }
        }
    }
}
int main(void){
    cin>>n>>a>>b;
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    sort(v,v+n);
    reverse(v,v+n);
    int t=a;
    long long sum=0;
    int i=0;
    comb(n);
    for(int i=0;i<a;i++){
        sum+=v[i];
    }
       double ave=(double)sum/a;
    int num=0,pos=0;
    for(int i=0;i<n;i++){
        //個数
        if(v[i]==v[a-1]){
            num++;
            if(i<a){
                pos++;
            }
        }
    }
    long long cnt=0LL;
    if(pos==a){
        for(pos=a;pos<=b;pos++){
            cnt+=c[num][pos];
        }
    }else{
        cnt+=c[num][pos];
    }
    cout.precision(20);
    cout<<fixed<<ave<<endl;
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define all(a) (a).begin(), (a).end()

int main() {
	int h, w;
	while (cin >> h >> w && h > 0) {
		cout << string(w, '#') << endl;
		for (int i = 0; i < h - 2; ++i)
			cout << '#' << string(w - 2, '.') << '#' << endl;
		cout << string(w, '#') << endl << endl;
	}

	return 0;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define EFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i, n) FOR(i,0,n)
const int MOD = 1000000007;

int main(void){
    ll X,gold500,gold5,ans = 0;
    cin >> X;
    gold500 = X/500;
    gold5 = (X-gold500*500)/5;
    ans = gold500 * 1000 + gold5*5;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

int main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b)*h / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K;
    cin >> N >> K;
    ll sum1 = N * (2 * K + (2*N-1));
    ll sum2 = N * (2 * (K+2*N) + (N-1)) / 2;
    if(sum1 > sum2){
        print(-1);
        return 0;
    }

    ll a[100010], b[100010], c[100010];
    rep(i,K+2*N, K+3*N) c[i-K-2*N] = i;
    vector<lpair> lp;
    ll val = K + N - 1 + (N+1) / 2;
    for(ll i = K; i <= K+N-1; i+=2){
        lp.push_back({i, val});
        val--;
    }
    val = K + 2 * N - 1;
    for(int i = K+1; i <= K+N-1; i += 2){
        lp.push_back({i, val});
        val--;
    }
    sort(lp.begin(), lp.end(), [](lpair l1, lpair l2){
        return l1.first + l1.second < l2.first + l2.second;
    });
    rep(i,0,N){
        a[i] = lp[i].first;
        b[i] = lp[i].second;
    }

    rep(i,0,N){
        print(a[i], b[i], c[i]);
    }

}

Measured memory_bytes: 6640
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0;i<(n);i++)
#define ALL(v) v.begin(), v.end()
#define INF 1e9
#define ll long long
#define P pair<ll, ll>

using namespace std;


void solve(long long N, std::vector<long long> h){
    vector<ll> vec(N);
    vec[0] = h[0];
    ll cnt = 0;
    REP(i,N-1) vec[i+1] = h[i+1]-h[i];
    REP(i,N) if (vec[i] > 0) cnt += vec[i];
    cout << cnt << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> h(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&h[i]);
    }
    solve(N, std::move(h));
    return 0;
}


Measured memory_bytes: 256
n = int(input())

chain = 0
for _ in range(n):
  d1, d2 = map(int, input().split())
  if d1 == d2:
    chain +=1
  else:
    chain = 0
  if chain == 3:
    print('Yes')
    break
else:
  print('No')
  
  

Measured memory_bytes: 9036
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>

using namespace std;

int main(){

    string S;
    cin >> S;

    if (S == "Sunny"){
        cout << "Cloudy" << endl;
    } else if (S == "Cloudy"){
        cout << "Rainy" << endl;
    } else if (S == "Rainy"){
        cout << "Sunny" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
N = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))

t = [0] + t
for i in range(N):
    t[i + 1] += t[i]

y = [0] * (t[N] * 2 + 1)

for i, (t1, t2) in enumerate(zip(t, t[1:])):
    for x in range(2 * t1, 2 * t2):
        y[x + 1] = min(v[i], y[x] + 0.5)

y[2 * t[N]] = 0
for i, (t1, t2) in enumerate(zip(t[::-1], t[::-1][1:])):
    for x in range(2 * t1, 2 * t2, -1):
        y[x - 1] = min(y[x - 1], v[N - i - 1], y[x] + 0.5)

print(sum((y[i] + y[i + 1]) * 0.5 for i in range(t[N] * 2)) / 2)

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

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

template<typename P, typename Q>
istream& operator >> (istream& is, pair<P, Q>& p)
{
  is >> p.first >> p.second;
  return is;
}

template<typename T>
ostream& operator << (ostream& os, vector<T> v)
{
  os << "(";
  each (i, v) os << i << ",";
  os << ")";
  return os;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& v)
{
  each (i, v) is >> i;
  return is;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    if (n <= 999) cout << "ABC" << endl;
    else cout << "ABD" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <climits>
#include <cmath>
#include <string>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep01(i, n) for(int i = 0; i < (n) + 1; i++)
#define rep10(i, n) for(int i = 1; i < (n); i++)
#define rep11(i, n) for(int i = 1; i < (n) + 1; i++)
#define all(a) (a).begin(), (a).end()
typedef long long int ll;
typedef struct { int x; int y; } Pos;
using namespace std;

//ABC088D
const int dx[] = { 1,-1,0,0 }, dy[] = { 0,0,1,-1 };
int H, W;
int b = 0;
vector<vector<char>> s;
vector<vector<bool>> r;
vector<vector<int>> d;
queue<Pos> q;
int main()
{
    cin >> H >> W;
    s = vector<vector<char>>(W + 1, vector<char>(H + 1));
    r = vector<vector<bool>>(W + 1, vector<bool>(H + 1));
    d = vector<vector<int>>(W + 1, vector<int>(H + 1));
    rep11(y, H) rep11(x, W) {
        cin >> s[x][y];
        if (s[x][y] == '#') b++;
    }
    q.push(Pos{ 1, 1 });
    while (q.size() > 0) {
        Pos ref = q.front();
        q.pop();
        rep(i, 4) {
            int ckx = ref.x + dx[i];
            int cky = ref.y + dy[i];
            if (ckx <= 0 || ckx > W || cky <= 0 || cky > H) continue;
            if (r[ckx][cky]) continue;
            if (s[ckx][cky] == '#') continue;
            r[ckx][cky] = true;
            d[ckx][cky] = d[ref.x][ref.y] + 1;
            q.push(Pos{ ckx, cky });
        }
    }
    if(r[W][H])
        cout << H * W - b - d[W][H] - 1 << endl;
    else
        cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3648
# coding: utf-8
N = int(input())
s = list(input())
red = 0
blue = 0

for i in range(N):
    if s[i] == 'R':
        red += 1
    elif s[i] == 'B':
        blue += 1

if red > blue:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
//ライブラリ
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
#include <functional>
using namespace std;

//ユーティリティ
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(int i=n-1; i>=0; --i)
#define rreps(i,n) for(int i=n; i>0; --i)
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

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

//型
typedef long long unsigned int ll;
typedef pair<int, int> pair_i;
typedef pair<ll, ll> pair_ll;

//定数
#define inf = (1e9+9)
const double pi = (acos(-1));
const ll mod = 1e9 + 7;
const double eps = 1e-8;


int n, q;

//位置pos, 補正済みtime
struct node {
    int time, pos, kind;
    bool operator<(const node &p) const {
        return time < p.time;
    }
};

vector<node> v;

void input() {
    cin >> n >> q;
    for (int i = 0; i < n; i++) {
        int s, t, x;
        cin >> s >> t >> x;
        v.push_back({ s - x, x, 1 });
        v.push_back({ t - x, x, 0 });
    }
}

void solve() {
	//補正した時間を元に降順ソート
	sort(v.rbegin(), v.rend());
    multiset<int> sp;
    for (int i = 0; i < q; i++) {
    	//人ごとに処理をする
        int d;
        cin >> d;
        //人や範囲はソートされているので進めて良い。
        //最も近い工事が、今見ている人の時間dより早い時だけ考える
        //[3,5]:2では、通り過ぎたのでもう見なくて良い
        while (!v.empty() && v.back().time <= d) {
        	//開始イベントなら、マップに最も早いcorrを追加
        	//終了イベントなら、その区間を削除
            if (v.back().kind) sp.insert(v.back().pos);
            else sp.erase(sp.find(v.back().pos));
            v.pop_back();
        }
        //追加していった最初の工事の位置
        cout << (sp.empty() ? -1 : *sp.begin()) << endl;
    }	
}

int main() {
	input();
	solve();
}

Measured memory_bytes: 15340
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<(n);i++)
const int MOD = 987654319;// 1e9 + 7 ;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=300002;

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

       int n;
      cin>>n;
      cout<<(n-2)*180;
}

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

int main() {
	int n, d, x;
	cin >> n >> d >> x;
	vector<int> a(n); 
	for (auto& e : a)
	{
		cin >> e;
		e = (d - 1) / e + 1;
	}
	cout << accumulate(a.begin(), a.end(), x) << endl;

	return 0;
}

Measured memory_bytes: 256
a,b,c,k = list(map(int,input().split()))
ans = 0
l = [0b11,0b101,0b110]
if k%2 == 1:#奇数
    ans = b -a
else:#偶数
    ans = a-b    
if abs(ans) > pow(10,18):
    ans = 'Unfair'
print(ans)

Measured memory_bytes: 2940
n = int(input())

prev_t = 0
prev_x = 0
prev_y = 0

for i in range(n):
    t, x, y = map(int, input().split())

    dt = t - prev_t
    dx = abs(x - prev_x)
    dy = abs(y - prev_y)
    dist = dx + dy

    if dist > dt:
        print('No')
        exit()
    
    if dt % 2 != dist % 2:
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


int main(){
    ll K, X;
    cin >> K >> X;
    VL ans;
    for (ll i = X - K + 1; i <= X + K - 1; i++)
        ans.pb(i);


    for(int i : ans) cout << i << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define FOR(variable,a,b) for(variable=(a);variable<(b);variable++)

int main(){
    // import phase
    int i, delta;
    long result;
    
    // calclate phase
    while(scanf("%d", &delta) != EOF) {
        result = 0;
        FOR(i, 0, 600 / delta) {
            result += pow((double)i*delta, (double)2) * delta;
        }
        printf("%ld\n", result);
    }

    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <stdio.h>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <vector>
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

const int inf = 1e9 + 7;
const long long INF = 1e18 + 7;
const int maxn = 2e5 + 7;

int n, x, mx;
string s;

int main(){
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> s;
	for (int i = 0; i < n; i++){
		if (s[i] == 'I')
			x++;
		else
			x--;
		mx = max(mx, x);
	}
	cout << mx;
	return 0;
} 

Measured memory_bytes: 256